Re: 2 variables on same plot? [message #24842 is a reply to message #24841] |
Thu, 26 April 2001 03:44   |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
Cathy Smith wrote:
>
> Hi all,
>
> How do I plot 2 variables on 1 plot? They each have vastly
> different ranges. I believe I am supposed to use AXIS but I can't seem
> to get the 2nd plot to be scaled correctly.
>
> xt=indgen(365)
> plot,xt(0:90),omega(0:90),xstyle=8,ystyle=8
> axis,yrange=,ystyle=1,/save,yaxis=1,xaxis=0
> oplot,xt(0:90),prate(0:90),linestyle=2
>
> The 2nd y axis has values from 0 to 10 and the data ranges from 0 to 10
> but it is plotted from 0 to .001 or something like that.
>
> thanks
> Cathy Smith
>
> --
> "A round of victory lattes for everyone!!!!"
>
> ############################################################ ######
> # NOAA-CIRES Climate Diagnostics Center #
> # U of C Campus Box 216 Boulder, CO 80309-0216 #
> # e-mail cas@cdc.noaa.gov web:http://www.cdc.noaa.gov/~cas #
> # phone (303)497-6263 fax:(303)497-6449 #
> ############################################################ ######
Can't see anything wrong with your code (except for using () instead
of [] for array indexing). The procedure below does what it should, I
think. Try a statement like
print, min(prate(0:90),max=mm),mm
to see what your data range is really like.
In the future: please post code examples that work by cut&paste - th
eeasier it is for people to try out your code, the more likely will
you get an answer.
Cheers,
Martin
PRO second_axis
;; create dummy data
xt=indgen(365)
omega = sin(!DTOR*xt)
prate = 10.*cos(4.*!DTOR*xt)*cos(4.*!DTOR*xt)*exp(-xt/100.)
;; plot
plot,xt,omega,xstyle=8,ystyle=8
axis,yrange=,ystyle=1,/save,yaxis=1,xaxis=0
oplot,xt[0:90],prate[0:90],linestyle=2
END
--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie [[
[[ Bundesstr. 55, 20146 Hamburg [[
[[ phone: +49 40 41173-308 [[
[[ fax: +49 40 41173-298 [[
[[ martin.schultz@dkrz.de [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
|
|
|