[ncl-talk] Issue producing panel plot with single overlay plots

Adam Phillips asphilli at ucar.edu
Tue Feb 5 13:27:27 MST 2019


Hi Anne,
Whenever plots are incorrectly being drawn on separate pages or on one
page, it is quite likely that it has to do with incorrect calls to draw or
frame (either implicitly through a plotting function or explicitly).
Calling draw tells NCL to draw the graphic to the workstation, while
calling frame tells NCL to finish the current frame/page and to move to the
next one. gsn_panel and gsn_csm_contour* functions implicitly call both of
those procedures unless the resource list passed in specify otherwise.

To simplify your script highlighting draw/frame resources and procedures:
res = True
res at gsnDraw = False
res at gsnFrame = False
...
res2                  = True
res2 at gsnDraw             = False
res2 at gsnFrame            = False
...
plot(0) = gsn_csm_contour_map(wks, diff_means_lead0,res)
plot0   = gsn_csm_contour(wks, prob_lead0, res2)
overlay(plot(0),plot0)
draw(plot(0))
; repeat the above 4 lines for plot(1) and plot(2)
frame(wks)

resP                     = True
resP at gsnPanelXWhiteSpacePercent = 5
gsn_panel(wks, plot, (/1, 3/), resP)

The above calls draw 3 times, and frame once, before gsn_panel is called
(where gsnFrame/gsnDraw = True). This results in 2 pages in your output
workstation.

Try this:
res = True
res at gsnDraw = False
res at gsnFrame = False
...
res2                  = True
res2 at gsnDraw             = False
res2 at gsnFrame            = False
...
plot(0) = gsn_csm_contour_map(wks, diff_means_lead0,res)
plot0   = gsn_csm_contour(wks, prob_lead0, res2)
overlay(plot(0),plot0)
; repeat the above 3 lines for plot(1) and plot(2)

resP                     = True
resP at gsnPanelXWhiteSpacePercent = 5
gsn_panel(wks, plot, (/1, 3/), resP)

Hope that all makes sense. If you have further questions let ncl-talk know.
Adam

On Tue, Feb 5, 2019 at 12:05 PM Anne <anne.seidenglanz at unive.it> wrote:

> Hi,
>
> I am producing 3 polar projection plots in a panel, whereby each single
> has overlaid contours (using the 'overlay' procedure); see below, I also
> attached the complete script.
> In this way I end up with 2 png files, the 1st showing 1 plot that has all
> 3 plots overlaid on top of each other, and the 2nd one the actual, correct,
> panelled plot. For simple viewing purposes, this is fine for me, but when
> it comes to inserting the plots into a word document, also in another
> format, like .eps format, then only 1 file is being produced and when I
> insert it, only the wrong overlaid 3-in-1 plot appears.
>
> So my question is:  What is the best way in dealing with overlaid(!) plots
> in a panelled configuration, and how to produce them properly (i.e. format)
> if one wants to insert them into word? I also tried to reduce the size of
> the workstation but wasn't successful, they would still have a large frame.
>
> My goal is to have a nice, high quality eps file of my (paneled) plot.
>
> Thanks for any help,
> Anne
>
>          res at gsnCenterString = "NDJ "+field+" response"
>         plot(0) = gsn_csm_contour_map(wks, diff_means_lead0, res)
>         plot0   = gsn_csm_contour(wks, prob_lead0, res2)        ; 0.1
> shade all areas less than the
>         plot0   = gsn_contour_shade(plot0, 0.05, 999.,opt)      ; 0.05
> contour level (0.15 for 0.1 contour level)
>
>         overlay(plot(0),plot0)
>         draw(plot(0))
>
>          res at gsnCenterString = "DJF "+field+" response"
>         plot(1) = gsn_csm_contour_map(wks, diff_means_lead1, res)
>         plot1   = gsn_csm_contour(wks, prob_lead1, res2)        ; 0.1
> shade all areas less than the
>         plot1   = gsn_contour_shade(plot1, 0.05, 999.,opt)      ; 0.05
> contour level (0.15 for 0.1 contour level)
>
>         overlay(plot(1),plot1)
>         draw(plot(1))
>
>          res at gsnCenterString = "JFM "+field+" response"
>         plot(2) = gsn_csm_contour_map(wks, diff_means_lead2, res)
>         plot2   = gsn_csm_contour(wks, prob_JFM, res2)  ; 0.1 shade all
> areas less than the
>         plot2   = gsn_contour_shade(plot2, 0.05, 999.,opt)
>  ;0.05 contour level (0.15 for 0.1 contour level)
>
>         overlay(plot(2),plot2)
>         draw(plot(2))
>
>         frame(wks)
>
>
>             resP                     = True
>             resP at gsnPanelXWhiteSpacePercent = 5
>             gsn_panel(wks, plot, (/1, 3/), resP)
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>


-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190205/d3d357d7/attachment.html>


More information about the ncl-talk mailing list