[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 2 variables on same plot?



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=[0,11],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[0:90],omega[0:90],xstyle=8,ystyle=8
   axis,yrange=[0,11],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                                        [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[