[ncl-talk] plotting two variables in the same plot.

Mary Haley haley at ucar.edu
Sun Aug 21 15:22:35 MDT 2016


Geeta,

To plot both plots in the same space, you need to use the "overlay"
procedure.

First, change the Plot_NPIX_FIX variable to be unique when you call
gsn_csm_contour:

    Plot_NPIX_FIX_1             =
gsn_csm_contour(Wks_NPIX_FIX,RF_NPIX_FIX,Res)
; keep Long in X axis

   delete(RF_NPIX_FIX)

    NSCAN = 2872

    RF_NPIX_FIX     =  work(:,Fix_NSCAN-40:Fix_NSCAN+40,Fix_NP)  ; nlev X
nscan

    Plot_NPIX_FIX_2             =
gsn_csm_contour(Wks_NPIX_FIX,RF_NPIX_FIX,Res)
; keep Long in X axis

Then overlay one plot on the other using "overlay":

  overlay(Plot_NPIX_FIX_2,Plot_NPIX_FIX_1)  ; Plot_NPIX_FIX_1 will become
part of Plot_NPIX_FIX_2
  draw(Plot_NPIX_FIX_2)   ; This draws both plots
  frame(Wks_NPIX_FIX)

It's important to note that when you do an overlay like this, the axes in
the first plot (the "base" plot) is going to be used for the final result.
If the second plot (the "overlay" plot) is not in the same X/Y space as the
"base" plot, then part of your plot will be cut off. If this happens in
your case, then you need to set one or more of the trXMinF, trXMaxF,
trYMinF, trYMaxF resources to be large enough to accommodate both plots

Please see example overlay_13.ncl which illustrates this:

http://www.ncl.ucar.edu/Applications/overlay.shtml#ex13

--Mary



On Sun, Aug 21, 2016 at 10:14 AM, Geeta Geeta <geetag54 at yahoo.com> wrote:

> thanks Dennis.
>
> I was trying to plot all the nearby pixels (2780/26 and 2781/26 and so
> on...) in only ONE plot to know the longitudinal extent of the
> thunderclouds along with their heights. What I am able to see presently is
> only one/individual cells not as a group of cells.
>
> for example in the TXT file, I have selected
>      Rainrate   NSCAN   NPIX     NLEVEL
>     34.97       2797         14         68
>     49.18       2803         28         68
>     30.78       2842         20         68
>     53.60       2846         19         68
>     45.39       2847         19         68
>     32.31       2849         22         68
> *    32.62       2870         26         68*
> *    37.04       2871         26         68*
> *    74.36       2872         26         68*
> *    35.24       2873         26         68*
> *    39.35       2875         42         68*
>     30.52       2903         44         68
>     36.93       2911         46         68
>
> I want to plot all of these points in Bold together in one plot as they
> are a part of a group.
>
> thank you.
>
>
>
>
>
>
> On Sunday, 21 August 2016 8:16 PM, Dennis Shea <shea at ucar.edu> wrote:
>
>
> By default,  'gsn_csm_contour' draws and plots each frame.
>
> The panel page:
>    http://www.ncl.ucar.edu/Applications/panel.shtml
>
>   Res at gsnDraw  = False           ; don't draw
>   Res at gsnFrame = False           ; don't advance frame
>
> ...
> One approach:
>
>     Plot = new( 2, "graphic)
>     Plot(0) =   gsn_csm_contour(Wks_NPIX_FIX,RF_NPIX_FIX,Res)
>     [snip]
>     PLot(1) =   gsn_csm_contour(Wks_NPIX_FIX,RF_NPIX_FIX,Res)
>
> ;************************************************
>   resP                                = True                 ; modify the
> panel plot
>   resP at gsnMaximize        = True                 ; make large: ps, pdf,
> eps
> ; resP at gsnPanelMainString = "A common title"     ; new resource added in
> NCL V6.4.0
>   resP at txString           = "A common title"     ; use this for NCL
> V6.3.0 and earlier
>
>   gsn_panel(wks,Plot,(/2,1/),resP)               ; vertical
>   gsn_panel(wks,Plot,(/1,2/),resP)               ; horizontal
> ~
>
> On Sun, Aug 21, 2016 at 7:55 AM, Geeta Geeta <geetag54 at yahoo.com> wrote:
>
> I am plotting the orbital data (rain rate) from TRMM. In this data, lat
> and lon are itself 2 dim.
> Rainrate is a 3 dim variable and is varying as per nscan (data along the
> swath, 9248), npix (49), and nlevel (80).
>
> I have extracted all the points within a domain (5-20N/72-84E) which
> exceed a rain rate of 30mm/hr.
> I got a number of adjacent points where the rain rate is exceeding the
> above mentioned threshold (RF.txt20080402 file attached. 1st column is rain
> rate, 2nd column is NSCAN, 3rd column is NPIX and 4th column is NLEVEL.
>
> I been able to get a plot of height vs longitudes (nscan) for a fixed
> point (say 2870/26 where 2870 is nscan and 26 is the npix for which
> rainrate is more than 30mm/hr..plot attached).
>
> Now I wish to add ht vs longitude plot for the adjacent point say 2871/26
> too in the SAME plot.
> But two separate plots are created. I dont know how to go about doing
> this.
>  Pls suggest.
>
> ______________________________ _________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/ mailman/listinfo/ncl-talk
> <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160821/4dc29ee5/attachment.html 


More information about the ncl-talk mailing list