Re: multiple Y-axis for 2D plots [message #15765] |
Tue, 08 June 1999 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Robert King (kingrj2@bp.com) writes:
> I've taken this from "IDL Programming Techniques" by DWF. (Page 31).
> I'm also quite new to IDL and found this book a wonderful aid to
> programming - I use it practically every half hour that I'm programming !!
> Well worth getting a copy,
Oh, no. Now the book orders are going to be pouring in just
as I'm leaving on a vacation! Just thought I'd let you know
in case anyone missed me in the next couple of weeks and worried
that I couldn't handle the crushing load. :-)
Cheers,
David
P.S. Let's just say my wife made me hand over the dongle
about five minutes ago. I have two minutes left to
explain how color wor...
--
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
|
|
|
Re: multiple Y-axis for 2D plots [message #15769 is a reply to message #15765] |
Tue, 08 June 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Robert King (kingrj2@bp.com) writes:
> I *JUST* knew that answering a question using someone elses' code
> wouldn't work!
>
> In my answer (foolishly copied & posted without checking to see that it
> works first!) I put the YRange from 0 to 200. You'll probably want to
> change this to the maximum and mininum values of the second data set. You
> can find these by using :
>
> maxVal=MAX(data_set_two, MIN=minVal)
>
> Then modify the call to the AXIS procedure as follows:
>
> Axis, YAxis=1, YRange=[minVal,maxVal], /SAVE, YTitle=' Dashed Line :
> Pressure (mmHg)'
I ran into the same problem. (Although I *did* remember to
test it first. I've been embarrassed *way* too many times!).
But I've already fixed this for the next printing of the
book. :-)
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
|
|
|
Re: multiple Y-axis for 2D plots [message #15770 is a reply to message #15765] |
Tue, 08 June 1999 00:00  |
Robert King
Messages: 9 Registered: March 1999
|
Junior Member |
|
|
Hello again,
I *JUST* knew that answering a question using someone elses' code
wouldn't work!
In my answer (foolishly copied & posted without checking to see that it
works first!) I put the YRange from 0 to 200. You'll probably want to
change this to the maximum and mininum values of the second data set. You
can find these by using :
maxVal=MAX(data_set_two, MIN=minVal)
Then modify the call to the AXIS procedure as follows:
Axis, YAxis=1, YRange=[minVal,maxVal], /SAVE, YTitle=' Dashed Line :
Pressure (mmHg)'
Regards,
Robert
|
|
|
Re: multiple Y-axis for 2D plots [message #15771 is a reply to message #15765] |
Tue, 08 June 1999 00:00  |
Robert King
Messages: 9 Registered: March 1999
|
Junior Member |
|
|
noymer@mozart.ceped.ined.fr wrote in article
<7jj5ai$kin$1@nnrp1.deja.com>...
> Dear IDL newsgroup,
>
> I have data like this: a year vector (for the X-axis) and two
> data vectors (for the Y values of two curves). Now, the two data
> vectors are to be displayed on the same graph, but they have radically
> different Y-scales. Rather than multiply the smaller by, say 100, I
> would like to display them each on their own axis. By this, I mean
> just like the lower left panel of figure 10-12 in the "Using IDL"
> manual (p.200 in my version), except imagine the first curve being the
> distribution of temperature (as drawn), and the RH Y-axis not being
> Celsius, but being mmHg, and then imagine a second curve, giving the
> distribution of atmospheric pressure for the same locale. The LH
> Y-axis is for temp; the RH Y-axis is for pressure.
>
> Some people feel that such graphs are unreadable because they don't
> know without careful inspection of the caption which line goes with
> the RH-Y-axis and which goes with the LH-Y-axis. They have a point;
> the way out is to do two separate panels, closely stacked. But I
> would like to know if this is at least doable.
>
> From the documentation for axis (etc), it was unclear (at least to me)
> if this was possible, and all my experiments failed.
>
> Thanks in advance if anyone has any thoughts.
>
> Best,
> Andrew.
>
Andrew,
Sorry to everyone if someone's already posted an answer to this one -
my newsfeed is somewhat slow and tempermental to say the least... :(
I've taken this from "IDL Programming Techniques" by DWF. (Page 31).
I'm also quite new to IDL and found this book a wonderful aid to
programming - I use it practically every half hour that I'm programming !!
Well worth getting a copy, I'm sure that David will send you the details,
otherwise visit his web site at http://www.dfanning.com/
"data_set_one" would be your temp Vs Time data
"data_set_two" is the press Vs Time data.
Plot, data_set_one, YStyle=8, YTitle='Solid Line :Temp (deg C)' ,$
Position=[0.15,0.15,0.85,0.95]
Axis, YAxis=1, YRange=[0,200], /SAVE, YTitle=' Dashed Line : Pressure
(mmHg)'
OPlot, data_set_two, LineStyle=2
Hope that this helps
Regards,
Robert
|
|
|
Re: multiple Y-axis for 2D plots [message #15772 is a reply to message #15765] |
Tue, 08 June 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Andrew (noymer@mozart.ceped.ined.fr) writes:
> I have data like this: a year vector (for the X-axis) and two
> data vectors (for the Y values of two curves). Now, the two data
> vectors are to be displayed on the same graph, but they have radically
> different Y-scales. Rather than multiply the smaller by, say 100, I
> would like to display them each on their own axis. By this, I mean
> just like the lower left panel of figure 10-12 in the "Using IDL"
> manual (p.200 in my version), except imagine the first curve being the
> distribution of temperature (as drawn), and the RH Y-axis not being
> Celsius, but being mmHg, and then imagine a second curve, giving the
> distribution of atmospheric pressure for the same locale. The LH
> Y-axis is for temp; the RH Y-axis is for pressure.
>
> From the documentation for axis (etc), it was unclear (at least to me)
> if this was possible, and all my experiments failed.
From that wonderful IDL Programming Techniques book, written
by ol' whatshisname: :-)
data = Loaddata(1)
Plot, data, YStyle=8, YTitle='Solid Line', $
Position=[0.15, 0.15, 0.85, 0.95]
newdata = data * 5
Axis, YAxis=1, YRange=[Min(newdata), Max(newdata)], /Save, $
YTitle='Dashed Line'
OPlot, newdata, LineStyle=2
You can download the LoadData program from my web page
or just make up your own data. The trick is that SAVE
keyword on the AXIS command.
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
|
|
|