[ncl-talk] Panel plots and blocks on each indivdual plot

Rick Brownrigg brownrig at ucar.edu
Tue Oct 20 10:11:48 MDT 2015


Hi,

I'm not totally certain what is going on, but it very much sounds like you
are overwriting the graphics objects from previous plots; i.e., your
variable "dum" and "dum2". The way you've got things set up, these
variables would need to be dimensioned Nx4, where N is the number of
plots.

Also, I think that rather than write:

  do i = 0 , 3
    dum2(i)=gsn_add_polyline(wks,plot(gg),ixpts(i:i+1),iypts(i:i+1),resp)
  end do

you could write:

    dum2(gg) = gsn_add_polyline(wks, plot(gg), ixpts, iypts, resp)

and thus the graphics arrays just need to be dimensioned N.

Make sense?

Rick


On Tue, Oct 20, 2015 at 9:49 AM, Melissa Lazenby <M.Lazenby at sussex.ac.uk>
wrote:

> Hi NCL users
>
> I am plotting panel plots of different CMIP5 models and I would like to
> draw 2 boxes on each individual model plot.
>
> At the moment the code is only drawing 2 boxes on the last model plot of
> the panel.
>
> Please can someone advise me on making all the boxes appear on all the
> individual models.
>
> Many thanks!
>
> Kindest Regards
> Melissa
>
> Below is a snippet of my code to create these boxes on each of the models
> as I loop through the 30 models (gg)
>
>  plot(gg) = gsn_csm_contour_map(wks,ccr({-60:60},{-180:180}),rescn)
>
>
> ; create points for box
> ;************************************************
>  ypts = (/ -27, -27,  -37, -37, -27/)
>  xpts = (/55, 65, 65, 55, 55/)
> ;************************************************
> ; add the box
> ;************************************************
>   resp                  = True                      ; polyline mods desired
>   resp at gsLineColor      = "black"                     ; color of lines
>   resp at gsLineThicknessF = 3.0                       ; thickness of lines
>   ;resp at gsLineLabelString= "test"                    ; adds a line label
> string
>
> ; create array of dummy graphic variables. This is required, b/c each line
> ; must be associated with a unique dummy variable.
>
>   dum = new(4,graphic)
>
>  draw each line separately. Each line must contain two points.
>   do i = 0 , 3
>     dum(i)=gsn_add_polyline(wks,plot(gg),xpts(i:i+1),ypts(i:i+1),resp)
>   end do
>
> ; create points for box
> ;************************************************
>  iypts = (/ -18, -18,  -28, -28, -18/)
>  ixpts = (/90, 100, 100, 90, 90/)
> ;************************************************
> ; add the box 2
> ;************************************************
>   dum2 = new(4,graphic)
>
>  draw each line separately. Each line must contain two points.
>   do i = 0 , 3
>     dum2(i)=gsn_add_polyline(wks,plot(gg),ixpts(i:i+1),iypts(i:i+1),resp)
>   end do
> end do
>
> ; panel resource list  (if necessary)
>
> panres                = True              ; mod panel plot
>  panres at cnMinLevelValF       = -0.02
>   panres at cnMaxLevelValF       =  0.02
>   panres at cnLevelSpacingF      =  0.01
> panres at gsnPanelLabelBar   = True                ; add common colorbar
> panres at lbLabelFontHeightF = 0.015                 ; make labels larger
> panres at lbLabelStride = 1
> panres at gsnMaximize = True ; Maximize plot in frame.
> gsn_panel(wks,plot(:12),(/4,3/),panres)    ; panel 16 models at a time.
> gsn_panel(wks,plot(13:24),(/4,3/),panres)
> gsn_panel(wks,plot(25:),(/4,3/),panres)
>
> end
>
>
> _______________________________________________
> 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/20151020/cfcc0909/attachment.html 


More information about the ncl-talk mailing list