/YNOZERO [message #42672] |
Fri, 18 February 2005 09:02  |
Mr. No Address
Messages: 11 Registered: February 2005
|
Junior Member |
|
|
I'm trying to create a plot with a fixed YRANGE for YAxis=0 and a self
scaling range incorporating /YNOZERO for YAxis=1. Here is the code:
PLOT, TIME, DATA.TEMP1, COLOR=0, /NODATA, YRANGE=[30,45], YSTYLE=8
OPLOT, TIME, DATA.TEMP1, COLOR=1
AXIS, YAxis=1, /YNOZERO, /Save
OPLOT, TIME, DATA.TEMP2, COLOR=2
The above code produces a YAxis=1 that is the same scale as YAxis=0.
The only way I'm able to get YAxis=1 to a scale different than YAxis=0
is to explicitly set the range.
Gary
|
|
|
|
Re: /YNOZERO [message #42701 is a reply to message #42672] |
Tue, 22 February 2005 10:05   |
Mr. No Address
Messages: 11 Registered: February 2005
|
Junior Member |
|
|
Paolo Grigis wrote:
>
>
> Mr. No Address wrote:
>
>> Christopher Lee wrote:
>>
>>> In article <cv573u$mmc$1@news.nems.noaa.gov>, "Mr. No Address"
>>> <no_given_address@landofthelost.net> wrote:
>>>
>>>
>>>
>>>> I'm trying to create a plot with a fixed YRANGE for YAxis=0 and a self
>>>> scaling range incorporating /YNOZERO for YAxis=1. Here is the code:
>>>> PLOT, TIME, DATA.TEMP1, COLOR=0, /NODATA, YRANGE=[30,45], YSTYLE=8
>>>> OPLOT, TIME, DATA.TEMP1, COLOR=1
>>>> AXIS, YAxis=1, /YNOZERO, /Save
>>>> OPLOT, TIME, DATA.TEMP2, COLOR=2
>>>> The above code produces a YAxis=1 that is the same scale as YAxis=0.
>>>> The
>>>> only way I'm able to get YAxis=1 to a scale different than YAxis=0
>>>> is to
>>>> explicitly set the range.
>>>> Gary
>>>
>>>
>>>
>>>
>>> What do you want Yaxis=1 to scale to?
>>
>>
>>
>> I'd like YAxis=1 to self scale using DATA.TEMP2 in the following OPLOT
>
>> line.
>
> Use the crystall ball object (part of the esoteric library):
>
> future_argument=crystal_ball->do_prophecy(/get_future_argument,/extrapolate)
>
>
> (use of the keyword /guess instead of /extrapolate is faster, but
> less accurate)
>
> ;-)
Every time I post here, infrequently that it is, I always feel, make
that know, I am opening myself up to clever responses. If you have a
moment, read my response to Fanning that explains why it seems (to me)
IDL should be able to see the future. It also has my solution that I
think I'm going to stick with.
Your solution is noted though. Thanks for taking the time to respond.
Cheers,
Gary
> ------------------------------------------------------------ --
>
> On a more serious tone, what about doing a supplementary plot
> beforehand and storing the !y.crange somewhere, and reusing that
> as input yrange to the axis procedure? Or, if you don't have
> the data before doing the first plot, save !P.multi, switch to
> device NULL, plot DATA.TEMP2, save !y.crange, switch to your former
> plot device, restore !P.multi and call AXIS with yrange equal the
> saved !y.crange. Maybe not 100% straightforward... but it should work.
>
>
>
> x=[1,2,3]
> y=[2,3,5]
> ;we don't know the third array yet...
>
> !p.multi=[0,2,2]
>
> plot,x
>
> ;now we get the new data
> z=[10,8.6,10]
>
> pmulti=!p.multi
>
> set_plot,'NULL'
> plot,z,/ynozero
> yrange=!y.crange
>
> set_plot,'X'
> !p.multi=pmulti
> plot,y,ystyle=8
>
> AXIS, YAxis=1, /YNOZERO, /Save,yrange=yrange
>
> oplot,z
>
>
>
> Ciao,
> Paolo
>
>
>> line. I want the /YNOZERO option so that zero is not used for the min
>> Y value. I did think about doing something similar to your code
>> below. I'm using !P.MULTI = [0,2,2] though and each new instance of
>> Plot creates a plot in the next panel. Of course, there is probably a
>> way to prevent that... Maybe I'd have to use POSITION instead of
>> !P.MULTI.
>>
|
|
|
Re: /YNOZERO [message #42702 is a reply to message #42672] |
Tue, 22 February 2005 09:54   |
Mr. No Address
Messages: 11 Registered: February 2005
|
Junior Member |
|
|
David Fanning wrote:
> Mr. No Address writes:
>
>
>> I'm using !P.MULTI = [0,2,2] though and each new instance of Plot
>> creates a plot in the next panel. Of course, there is probably a way to
>> prevent that...
>
>
> I'd try NOERASE for starters. :-)
OK, I'm going to plead ignorance and stick with what I've done that
accomplishes essentially what I want. Setting the range to MIN,MAX
values as determined by the MIN MAX functions. I did try NOERASE but
with initially unexpected results, but reasonable once considered.
Everytime I look at the description of AXIS though, I keep getting lured
in by the availability of /YNOZERO and the description "The new scale is
saved for use by subsequent overplots if the SAVE keyword parameter is
set." I see it says "new scale is saved," but /YNOZERO has as part of
the description "...and no explicit minimum Y value is specified." So
it _should_ be able to "see" into the future!
Anyway, I think for me this isn't worth pursuing further as my
"solution" is perfectly adequate.
Gary
|
|
|
Re: /YNOZERO [message #42704 is a reply to message #42672] |
Tue, 22 February 2005 09:32   |
Paolo Grigis
Messages: 171 Registered: December 2003
|
Senior Member |
|
|
Mr. No Address wrote:
> Christopher Lee wrote:
>
>> In article <cv573u$mmc$1@news.nems.noaa.gov>, "Mr. No Address"
>> <no_given_address@landofthelost.net> wrote:
>>
>>
>>
>>> I'm trying to create a plot with a fixed YRANGE for YAxis=0 and a self
>>> scaling range incorporating /YNOZERO for YAxis=1. Here is the code:
>>> PLOT, TIME, DATA.TEMP1, COLOR=0, /NODATA, YRANGE=[30,45], YSTYLE=8
>>> OPLOT, TIME, DATA.TEMP1, COLOR=1
>>> AXIS, YAxis=1, /YNOZERO, /Save
>>> OPLOT, TIME, DATA.TEMP2, COLOR=2
>>> The above code produces a YAxis=1 that is the same scale as YAxis=0. The
>>> only way I'm able to get YAxis=1 to a scale different than YAxis=0 is to
>>> explicitly set the range.
>>> Gary
>>
>>
>>
>> What do you want Yaxis=1 to scale to?
>
>
> I'd like YAxis=1 to self scale using DATA.TEMP2 in the following OPLOT
> line.
Use the crystall ball object (part of the esoteric library):
future_argument=crystal_ball->do_prophecy(/get_future_argument,/extrapolate)
(use of the keyword /guess instead of /extrapolate is faster, but
less accurate)
;-)
------------------------------------------------------------ --
On a more serious tone, what about doing a supplementary plot
beforehand and storing the !y.crange somewhere, and reusing that
as input yrange to the axis procedure? Or, if you don't have
the data before doing the first plot, save !P.multi, switch to
device NULL, plot DATA.TEMP2, save !y.crange, switch to your former
plot device, restore !P.multi and call AXIS with yrange equal the
saved !y.crange. Maybe not 100% straightforward... but it should work.
x=[1,2,3]
y=[2,3,5]
;we don't know the third array yet...
!p.multi=[0,2,2]
plot,x
;now we get the new data
z=[10,8.6,10]
pmulti=!p.multi
set_plot,'NULL'
plot,z,/ynozero
yrange=!y.crange
set_plot,'X'
!p.multi=pmulti
plot,y,ystyle=8
AXIS, YAxis=1, /YNOZERO, /Save,yrange=yrange
oplot,z
Ciao,
Paolo
> line. I want the /YNOZERO option so that zero is not used for the min Y
> value. I did think about doing something similar to your code below.
> I'm using !P.MULTI = [0,2,2] though and each new instance of Plot
> creates a plot in the next panel. Of course, there is probably a way to
> prevent that... Maybe I'd have to use POSITION instead of !P.MULTI.
>
|
|
|
|
Re: /YNOZERO [message #42765 is a reply to message #42702] |
Fri, 25 February 2005 01:13  |
Paolo Grigis
Messages: 171 Registered: December 2003
|
Senior Member |
|
|
Mr. No Address wrote:
> David Fanning wrote:
>
>> Mr. No Address writes:
>>
>>
>>> I'm using !P.MULTI = [0,2,2] though and each new instance of Plot
>>> creates a plot in the next panel. Of course, there is probably a way
>>> to prevent that...
>>
>>
>>
>> I'd try NOERASE for starters. :-)
>
>
> OK, I'm going to plead ignorance and stick with what I've done that
> accomplishes essentially what I want. Setting the range to MIN,MAX
> values as determined by the MIN MAX functions. I did try NOERASE but
> with initially unexpected results, but reasonable once considered.
> Everytime I look at the description of AXIS though, I keep getting lured
> in by the availability of /YNOZERO and the description "The new scale is
> saved for use by subsequent overplots if the SAVE keyword parameter is
> set." I see it says "new scale is saved," but /YNOZERO has as part of
> the description "...and no explicit minimum Y value is specified." So
> it _should_ be able to "see" into the future!
Then maybe the flaw is in the manuals here...
The behaviour of axis seems to be like this:
- if yrange is explicitely given, use that yrange
(/ynozero not relevant)
- if yrange is not given, than take !y.crange as yrange
(/ynozero not relevant)
- if !y.crange is undefined (that is, equal [0,0], I guess)
than use [0,1] as yrange (/ynozero again unrelevant)
(example:
IDL> plot,[10,13,12,11],yrange=[10,20]
IDL> axis,1,0,/yaxis,yrange=[9,15]
IDL> axis,1.25,0,/yaxis
IDL> !y.crange=[0,0]
IDL> axis,1.5,0,/yaxis
)
So it seems to me that /ynozero does not really affects the
behavior of AXIS, and maybe its documentation should be removed
from the manuals...
Cheers,
Paolo
>
> Anyway, I think for me this isn't worth pursuing further as my
> "solution" is perfectly adequate.
>
> Gary
>
|
|
|