Re: Figuring out axis range? [message #28477] |
Wed, 12 December 2001 07:21 |
bowler
Messages: 7 Registered: February 1998
|
Junior Member |
|
|
David Fanning <david@dfanning.com> writes:
> Bruce Bowler (bbowler@bigelow.org) writes:
>
>> I have some data that I'm trying to plot where the xaxis data range is (from min and max) [0,3.19377] and the yaxis range is [-85,85]. The y axis values are fixed, the x
>> axis values change depending on the data set. Sometimes, the plot that results from plot,x,y,yrange=[-90,90],/ystyle has an x axis that starts at 0, sometimes it starts at -
>> 1 (in the particular case shown here, the range plotted is [-1,5]). I'd like to force the xaxis to start at 0 (the minimum is *never* negative) and have a "nice" upper bound
>> (so /xstyle doesn't work). Is there an option I'm missing? Is there a routine that will return a "nice" number (like 4, not 3.19377, or 250 if 248.9 is input), is the algorithm
>> that IDL uses to determine plot ranges documented anywhere?
>
> For a "nice number" axis range that always starts at 0,
> I'd try setting XRANGE=[0,Max(data)], with XSTYLE=0.
> The algorithm IDL uses is not documented anywhere I know
> about, but a "pretty axis" is more-or-less IDL's thing,
> and always when you least expect it. :-)
Tried that, same result, but I found a routine called nicenumber :-) at in the
JHU-APL archive. That, in conjunction with /xstyle comes very close to what
I'm looking for.
Bruce
|
|
|
Re: Figuring out axis range? [message #28480 is a reply to message #28477] |
Wed, 12 December 2001 06:34  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Bruce Bowler (bbowler@bigelow.org) writes:
> I have some data that I'm trying to plot where the xaxis data range is (from min and max) [0,3.19377] and the yaxis range is [-85,85]. The y axis values are fixed, the x
> axis values change depending on the data set. Sometimes, the plot that results from plot,x,y,yrange=[-90,90],/ystyle has an x axis that starts at 0, sometimes it starts at -
> 1 (in the particular case shown here, the range plotted is [-1,5]). I'd like to force the xaxis to start at 0 (the minimum is *never* negative) and have a "nice" upper bound
> (so /xstyle doesn't work). Is there an option I'm missing? Is there a routine that will return a "nice" number (like 4, not 3.19377, or 250 if 248.9 is input), is the algorithm
> that IDL uses to determine plot ranges documented anywhere?
For a "nice number" axis range that always starts at 0,
I'd try setting XRANGE=[0,Max(data)], with XSTYLE=0.
The algorithm IDL uses is not documented anywhere I know
about, but a "pretty axis" is more-or-less IDL's thing,
and always when you least expect it. :-)
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|