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
|
|
|