[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IDLgrAxis expanding

Pavel Romashkin (promashkin@cmdl.noaa.gov) writes:

> When an instance of IDLgrAxis is created without /EXACT keyword, it is
> adjusted by IDL so that tick labels are nicely rounded. However, this
> has a side effect of non-/EXACT axis extending past the limit of the
> VIEWPLANE_RECTANGLE for the parent IDLgrView. Sometimes this expansion
> is really large.  Is there a way to make IDLgrAxis to round ticks but
> lie inside the VIEWPLANE_RECTANGLE? 

If there is a way, it must be undocumented. :-(

This is a maddening "feature" of the object axes. For example,
if you set the axis range from 0 to 12.6, IDL actually creates
an axis that has a range from 0 to 14. But if you ask the axis
what its range is:

   thisAxis->GetProperty, Range=thisRange

It reports that its range is 0 to 12.6. Aaaughh!

Of course, it is impossible to scale an axis like this into
any sort of coordinate system, so you have two choices. You 
can always use exact axis scaling (which is what I do because
I'm fairly anal and I like my axes pairs to be at nice right
angles to one another and where I put them, for God's sake).
Or, you can have IDL scale them haphazardly and have axes
end points sticking out every which way and never meeting
at a point.

You may have noticed that none of the IDL object graphic
examples ever use box-style axes. This is the reason why.

In object graphic's defense, it is quite easy (well, alright,
once you figure it out, it is quite easy) to write your programs
so that the user can drag the axes around and put them wherever
he or she likes. I suppose you could always "nudge" your axes
back together once they appeared if you were picky about 
appearance, but this does seem a little over the top for
nice looking axes. Of course, this does nothing to solve
the problem of axes extending outside the "plot space".

> Any suggestions? 

Yes, several. If axes are going to autoscale, at least 
have them report the values they autoscale to. Failing this, 
publish the axis autoscaling algorithms so that we can create 
better guesses as to what our axes are really going to do.

But, frankly, if line plots are what you want to do, and
you want object-like properties, it probably makes more
sense to write your own "plot object" in direct graphics.
This has the advantage of simplicity and familiarity.
Plot objects are powerful and work nicely. And they 
take 5 seconds to print rather than 5 minutes. Anyone
who has taken one of my object-oriented programming
classes could build one in about a third the time it would
take to build an object graphics plot. :-)



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