[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: IDLgrAxis object with /LOG keyword
- Subject: Re: IDLgrAxis object with /LOG keyword
- From: davidf(at)dfanning.com (David Fanning)
- Date: Thu, 18 Jan 2001 12:14:49 -0700
- Newsgroups: comp.lang.idl-pvwave
- Organization: Fanning Software Consulting
- References: <3A66C90D.12F19092@hotmail.com>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:23056
Marc Schellens (m_schellens@hotmail.com) writes:
> I want to create a loarithmic plot with object graphics.
> So I thought I just set the /LOG keyword to the IDLgrAxis object and
> scale the data accordingly.
> But with the /LOG keyword the Axis is drawn on a different location.
> Does anybody have an example how to do it right?
Humm. This gave me some trouble too. Then I remembered that
CRANGE returns the log of the range when axes are set to
log type. So, to get things to work, I had to scale the
axis (Z-Axis in this case) differently from the data in
the Z direction.
Here is how I modified my FSC_SURFACE program to get
it to work with a log Z axis. (I set the LOG keyword
on the IDLgrAxis command for the Z axis.)
***********************************************************************
; The axes may not use exact axis scaling, so the ranges may
; have changed from what they were originally set to. Get
; and update the range variables.
xAxis->GetProperty, CRange=xrange
yAxis->GetProperty, CRange=yrange
zAxis->GetProperty, CRange=zrange
zrange_surf = [10^zrange[0], 10^zrange[1]]
; Set scaling parameters for the surface and axes so that everything
; is scaled into the range -0.5 to 0.5. We do this so that when the
; surface is rotated we don't have to worry about translations. In
; other words, the rotations occur about the point (0,0,0).
xs = Normalize(xrange, Position=[-0.5,0.5])
ys = Normalize(yrange, Position=[-0.5,0.5])
zs = Normalize(zrange, Position=[-0.5,0.5])
zsurf = Normalize(zrange_surf, Position=[-0.5,0.5])
; Scale the axes and place them in the coordinate space.
; Note that not all values in the Location keyword are
; used. (I've put really large values into the positions
; that are not being used to demonstate this.) For
; example, with the X axis only the Y and Z locations are used.
xAxis->SetProperty, Location=[9999.0, -0.5, -0.5], XCoord_Conv=xs
yAxis->SetProperty, Location=[-0.5, 9999.0, -0.5], YCoord_Conv=ys
zAxis->SetProperty, Location=[-0.5, 0.5, 9999.0], ZCoord_Conv=zs
; Scale the surface.
thisSurface->SetProperty, XCoord_Conv=xs, YCoord_Conv=ys, ZCoord_Conv=zsurf
***********************************************************************
I put this example program here if you want to try it out:
ftp://ftp.dfanning.com/oub/outgoing/misc/fsc_surface_log.pro
I ran it like this:
IDL> .Compile fsc_surface_log
IDL> fsc_surface, dist(50)*40 > 1
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155