[ncl-talk] add text to panel plot

Tabish Ansari tabishumaransari at gmail.com
Mon Apr 29 17:25:42 MDT 2019


Hi Rick

I was able to solve the issue by using gsn_add_text instead. I had to
supply lat/lon values instead of ndc coordinates and attach the text to
each plot separately and then panel them.

Cheers

Tabish

Tabish U Ansari
PhD student, Lancaster Environment Center
Lancaster Univeristy
Bailrigg, Lancaster,
LA1 4YW, United Kingdom


On Tue, 30 Apr 2019 at 00:09, Tabish Ansari <tabishumaransari at gmail.com>
wrote:

> Hi Rick,
>
> In that case it prints the text on a new frame. I get a 2 page PDF with
> the plots on the first page and just the text on the second.
>
> Tabish
>
> Tabish U Ansari
> PhD student, Lancaster Environment Center
> Lancaster Univeristy
> Bailrigg, Lancaster,
> LA1 4YW, United Kingdom
>
>
> On Mon, 29 Apr 2019 at 23:56, Rick Brownrigg <brownrig at ucar.edu> wrote:
>
>> Hi Tabish,
>>
>> I don't know, but I have to wonder what happens if you place the call to
>> gsn_text_ndc() after the call to gsn_panel()?
>>
>>
>>
>> On Mon, Apr 29, 2019 at 4:48 PM Tabish Ansari <tabishumaransari at gmail.com>
>> wrote:
>>
>>> Hi
>>>
>>> I'm trying to add some text using gsn_text_ndc over a panel plot but it
>>> goes underneath the plots. Is there a way to write some text over the panel
>>> plots?
>>>
>>> Here's my script:
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"load
>>> "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"begin  a1 =
>>> addfile("/mnt/rasher/zero-out_runs/run0/subset_d03_2014-10-23_010000.nc
>>> <http://subset_d03_2014-10-23_010000.nc>","r")           ; Open a file  a2
>>> = addfile("/mnt/rasher/zero-out_runs/run0/subset_d03_2014-10-24_010000.nc
>>> <http://subset_d03_2014-10-24_010000.nc>","r")           ; Open a file  b =
>>> addfile("/mnt/rasher/control-run-so4-ECMWF/wrfout_d03_2014-10-24_010000.nc
>>> <http://wrfout_d03_2014-10-24_010000.nc>","r")           ; Open a file  wks
>>> = gsn_open_wks("x11","episode-maps")         ; Create a plot workstation
>>> opts = True                                  ; Set some Basic Plot
>>> options;  opts at MainTitle = "GEOGRID FIELDS"  opts at InitTime =
>>> False                        ; Do not plot time or footers  opts at Footer =
>>> False      pehla = a1->PM2_5_DRY(15:23,0,:,:)           ; Read the variable
>>> to memory  dusra = a2->PM2_5_DRY(0:14,0,:,:)           ; Read the variable
>>> to memory  pehlaSum = dim_sum_n(pehla,0)  dusraSum = dim_sum_n(dusra,0)
>>> pm25 = (pehlaSum+dusraSum)/24.0  pm25 at description=""
>>> printVarSummary(pm25)  res = opts                                   ; Use
>>> basic options for this field  res at cnFillOn = True
>>> ; Create a color fill plot  ;res at cnFillPalette       =
>>> "BlGrYeOrReVi200"      ; Set color map;  res at cnFillPalette       =
>>> "BlueRed"      ; Set color map  res at ContourParameters = (/ 0, 340, 20 /) ;
>>> Set the levelsres at pmLabelBarOrthogonalPosF = -0.05  contour =
>>> wrf_contour(a1,wks,pm25,res)  pltres = True
>>> ; Set plot options  pltres at NoHeaderFooter = True    pltres at PanelPlot = True
>>>   mpres = True                                 ; Set map options
>>> mpres at mpOutlineBoundarySets       = "Allboundaries"
>>> mpres at mpUSStateLineDashPattern    = 0  mpres at mpOutlineOn           = True
>>> mpres at mpDataBaseVersion        = "MediumRes"
>>> mpres at mpDataSetName            = "Earth..4"      ; U.S.
>>> countiesmpres at mpGeophysicalLineColor      = "Black"  ; Overwrite basic map
>>> settings  mpres at mpGridLineColor             = "Black"
>>> mpres at mpLimbLineColor             = "Black"
>>> mpres at mpNationalLineColor         = "Black"
>>> mpres at mpPerimLineColor            = "Black"
>>> mpres at mpUSStateLineColor          = "Black"  plot1 =
>>> wrf_map_overlays(b,wks,(/contour/),pltres,mpres) ; Plot field over map
>>> background;;;NOW FOR EPISODE 2;;;  a1 =
>>> addfile("/mnt/rasher/zero-out_runs/run0/subset_d03_2014-10-29_010000.nc
>>> <http://subset_d03_2014-10-29_010000.nc>","r")           ; Open a file  a2
>>> = addfile("/mnt/rasher/zero-out_runs/run0/subset_d03_2014-10-30_010000.nc
>>> <http://subset_d03_2014-10-30_010000.nc>","r")           ; Open a file
>>> pehla = a1->PM2_5_DRY(15:23,0,:,:)           ; Read the variable to memory
>>> dusra = a2->PM2_5_DRY(0:14,0,:,:)           ; Read the variable to memory
>>> pehlaSum = dim_sum_n(pehla,0)  dusraSum = dim_sum_n(dusra,0)  pm25 =
>>> (pehlaSum+dusraSum)/24.0  res at ContourParameters = (/ 0, 280, 20 /) ; Set
>>> the levels  contour = wrf_contour(a1,wks,pm25,res)  plot2 =
>>> wrf_map_overlays(b,wks,(/contour/),pltres,mpres) ; Plot field over map
>>> background  ; Panel the WRF plots.    pnlres                            =
>>> True    ;pnlres at txString                   = t at description + "  (" +
>>> t at units + ")"    pnlres at gsnPanelYWhiteSpacePercent = 13       ; Add white
>>> space b/w plots.   ; pnlres at gsnPanelLabelBar           = True    ; Turn on
>>> common labelbar   ; pnlres at lbLabelAutoStride          = True    ; Spacing
>>> of lbar labels.   ; pnlres at lbBoxMinorExtentF          =
>>> 0.13txres               = Truetxres at txFontHeightF =
>>> 0.020gsn_text_ndc(wks,"Beijing avg=258
>>> ~F33~m~F21~gm~S~-3~N~",0.38,0.4935,txres)gsn_panel(wks,(/plot1,plot2/),(/1,2/),pnlres)end*
>>>
>>>
>>> Cheers
>>>
>>> Tabish
>>>
>>> Tabish U Ansari
>>> PhD student, Lancaster Environment Center
>>> Lancaster Univeristy
>>> Bailrigg, Lancaster,
>>> LA1 4YW, United Kingdom
>>> _______________________________________________
>>> 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/20190430/39a680af/attachment.html>


More information about the ncl-talk mailing list