Re: overplotting with a new axis [message #11272] |
Tue, 17 March 1998 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
David Mottershead (DMottershead@mhl.nsw.gov.au) writes:
> Is there a way to overplot two lots of data using two different x-axes.
To modify the code just slightly from page 31 in my book:
curve1 = LoadData(1)
curve2 = Findgen(50)
curve2 = Sin(curve2/5)/Exp(curve2/50) * 15 + 15
Plot, curve1, XStyle=8, XTitle='Solid Line Axis', $
Position=[0.1, 0.15, 0.95, 0.9]
Axis, XAxis=1, XRange=[0,50], /Save, XTitle='Dashed Line Axis'
OPlot, curve2, LineStyle=2
The key is the SAVE keyword on the AXIS command. You want
to make sure that when you OPLOT the second curve that you
use the scaling parameters from the correct axis.
Cheers,
David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|