comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » /YNOZERO
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
/YNOZERO [message #42672] Fri, 18 February 2005 09:02 Go to next message
Mr. No Address is currently offline  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 #42700 is a reply to message #42672] Tue, 22 February 2005 10:44 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Mr. No Address writes:

> Anyway, I think for me this isn't worth pursuing further as my
> "solution" is perfectly adequate.

I used to go for elegant solutions, but I'm more relaxed
about it these days. "Whatever works", as my youngest often
says to me. I've found it saves time for yoga, my latest
passion. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: /YNOZERO [message #42701 is a reply to message #42672] Tue, 22 February 2005 10:05 Go to previous messageGo to next message
Mr. No Address is currently offline  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 Go to previous messageGo to next message
Mr. No Address is currently offline  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 Go to previous messageGo to next message
Paolo Grigis is currently offline  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 #42705 is a reply to message #42672] Tue, 22 February 2005 09:21 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
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. :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: /YNOZERO [message #42765 is a reply to message #42702] Fri, 25 February 2005 01:13 Go to previous message
Paolo Grigis is currently offline  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
>
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: file_basename(): bug or feature?
Next Topic: detection of events from the serial port

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:52:48 PDT 2025

Total time taken to generate the page: 0.00669 seconds