[ncl-talk] Add text leftwards of time-series plot (OR, shift plot rightwards in viewport)

Adam Phillips asphilli at ucar.edu
Thu Oct 24 12:11:40 MDT 2019


Hi Tabish,
It seems as though your query posted a number of weeks ago was not
answered. Did you find a resolution to this issue?
Looking at your code this setting should have a range of between 0 and 1:
res3 at vpWidthF    = 4
I would try adjusting that to 0.8, and then also set:
res3 at vpXF = 0.15
vpXF is the starting point on the x-plane for the left edge of the plot
boundary (valid values are 0 to 1), and vpWidthF is the width of the plot
itself. Playing with those two settings should solve your issue.
Adam


>
> ---------- Forwarded message ---------
> From: Tabish Ansari via ncl-talk <ncl-talk at ucar.edu>
> Date: Mon, Sep 9, 2019 at 8:27 PM
> Subject: [ncl-talk] Add text leftwards of time-series plot (OR, shift plot
> rightwards in viewport)
> To: ncl-talk at ucar.edu USERS <ncl-talk at ucar.edu>
>
>
> Hi
>
> I've created a panel of some time-series plots with attached x-axes. I
> want to add some text on the left hand side of each of these plots.
> However, there isn't adequate space to do this. Is there a way to shift the
> plot rightwards in the viewport so that more white space can be created?
>
> The plot is attached.
>
> Here's the script:
>
> ; These files still have to be loaded manually
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/time_axis_labels.ncl"
> ;load "/data1/tabish/nclscripts/cd_inv_string.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/cd_string.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>
>
>
> begin
>
> emisarr0 = (/100,100,100,100, 100,100,100,100, 100,100,100,100/)
> emisarr1 = (/ 40,100,100,40, 100,100,100,100, 100,100,100,100/)
> emisarr2 = (/20,20,20,20, 100,100,100,100, 100,100,100,100/)
> emisarr3 = (/40,40,40,40, 40,100,100,40, 100,100,100,100/)
> emisarr4 = (/40,40,40,40, 40,40,40,40, 100,100,100,100/)
> emisarr5 = (/40,40,40,40, 40,40,40,40, 40,40,40,40/)
> emisarr6 = (/30,30,30,30, 30,30,30,30, 30,30,30,30/)
> emisarr7 = (/20,20,20,20, 20,20,20,20, 20,20,20,20/)
> emistimearr = ispan(1,12,1)
>
>
> ;---Start the graphics
> wks = gsn_open_wks("pdf","MPCpolicy") ; send graphics to PNG file
>
>
> ; frame(wks)
> ; xy1 will be the base plot.
> ;  amid = gsn_attach_plots(xy1,(/xy2,xy3,xy4,xy5,xy6/),res1,res2)
>
> res3 = True
> res3 at vpXF                 = 0.35       ; x location
>
> res3 at gsnXYBarChart = True            ; Create bar plot
> res3 at trYMaxF     =  100
> res3 at trYMinF     =  0
>
> res3 at tmXTOn        = False
> res3 at tmYROn        = False
>
> ;DRAW TICKMARKS INWARDS
> res3 at tmXBMajorOutwardLengthF=0.0
> res3 at tmXBMinorOutwardLengthF=0.0
> res3 at tmYLMajorOutwardLengthF=0.0
> res3 at tmYLMinorOutwardLengthF=0.0
>
>
> res3 at tmXBMajorLengthF=0.0
> res3 at tmXBMinorLengthF=0.0
> res3 at tmXBMinorThicknessF=0.0
> res3 at tmYLMajorLengthF=0.03
> res3 at tmYLMinorLengthF=0.02
>
> res3 at tmYLMode        = "Explicit"
> res3 at tmYLValues      = (/0,20,40,60,80,100/)
> ;res3 at tmYLLabels      = "" + res at tmYLValues
> res3 at tmYLLabels      = (/"0","20","40","60","80","100"/)
> res3 at tmYLMinorValues = (/10,30,50,70,90/)
>
> res3 at tmXBMode = "Explicit"
> res3 at tmXBValues = (/1,2,3,4,5,6,7,8,9,10,11,12/)
> res3 at tmXBLabels = (/"I","T","P","R","I","T","P","R","I","T","P","R"/)
> ;res3 at tmXBMinorValues = (/-0.5,12.5,24.5,36.5,48.5,60.5/)
> res3 at tmXBMajorLengthF=0.0
> res3 at tmXBMinorLengthF=0.0
>
> res3 at gsnXYBarChartColors =
> (/"tomato","tomato","tomato","tomato","limegreen","limegreen","limegreen","limegreen","dodgerblue","dodgerblue","dodgerblue","dodgerblue"/)
>            ; choose colors
> res3 at xyLineColors = (/"black"/)
> res3 at vpWidthF    = 4
> res3 at vpHeightF   = 0.6
> res3 at gsnMaximize = True
>
> res3 at tmXBLabelFontHeightF = 0.035
> res3 at tmYLLabelFontHeightF = 0.06
> res3 at tiYAxisFontHeightF = 0.035
> res3 at tiYAxisString = "Emissions (%)"
> res3 at gsnDraw  = False                          ; don't draw
> res3 at gsnFrame = False                          ; don't advance frame
>
> emisplot0 = gsn_csm_xy (wks,emistimearr,emisarr0,res3)
> emisplot1 = gsn_csm_xy (wks,emistimearr,emisarr1,res3)
> emisplot2 = gsn_csm_xy (wks,emistimearr,emisarr2,res3)
> emisplot3 = gsn_csm_xy (wks,emistimearr,emisarr3,res3)
> emisplot4 = gsn_csm_xy (wks,emistimearr,emisarr4,res3)
> emisplot5 = gsn_csm_xy (wks,emistimearr,emisarr5,res3)
> emisplot6 = gsn_csm_xy (wks,emistimearr,emisarr6,res3)
> emisplot7 = gsn_csm_xy (wks,emistimearr,emisarr7,res3)
>
> ; emisplot0 will be the base plot.
>   res1                     = True
>   res2                     = True
>   res1 at gsnMaximize         = True
>   res2 at gsnAttachPlotsXAxis = True
>   amid =
> gsn_attach_plots(emisplot0,(/emisplot1,emisplot2,emisplot3,emisplot4,emisplot5,emisplot6,emisplot7/),res1,res2)
>
> txres               = True
> txres at txFontHeightF = 0.008
> gsn_text_ndc(wks,"Case0: PM~B~2.5~N~<75
> ~F33~m~F21~gm~S~-3~N~",0.01,0.915,txres)
> gsn_text_ndc(wks,"Case1: PM~B~2.5~N~=75-100
> ~F33~m~F21~gm~S~-3~N~",0.01,0.81,txres)
> gsn_text_ndc(wks,"Case2: PM~B~2.5~N~=101-125
> ~F33~m~F21~gm~S~-3~N~",0.01,0.68,txres)
> gsn_text_ndc(wks,"Case3: PM~B~2.5~N~=125-150
> ~F33~m~F21~gm~S~-3~N~",0.01,0.55,txres)
> gsn_text_ndc(wks,"Case4: PM~B~2.5~N~=151-175
> ~F33~m~F21~gm~S~-3~N~",0.01,0.45,txres)
> gsn_text_ndc(wks,"Case5: PM~B~2.5~N~=176-200
> ~F33~m~F21~gm~S~-3~N~",0.01,0.35,txres)
> gsn_text_ndc(wks,"Case6: PM~B~2.5~N~=201-220
> ~F33~m~F21~gm~S~-3~N~",0.01,0.23,txres)
> gsn_text_ndc(wks,"Case7: PM~B~2.5~N~>225
> ~F33~m~F21~gm~S~-3~N~",0.01,0.1,txres)
>
> draw(emisplot0)
> frame(wks)
>
> end
>
> Many thanks in advance.
>
> 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
>


-- 
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/20191024/25e929a4/attachment.html>


More information about the ncl-talk mailing list