[ncl-talk] Fwd: Sub: Plots not fit into specified region..

Adam Phillips asphilli at ucar.edu
Thu Mar 17 13:51:59 MDT 2016


Hello,
As a reminder please do not double post unless your query has not been
answered within 24 hours (Monday-Friday).

I was just able to use the utility convert to remove all white space around
your .pdf file:
convert -trim +repage eof.pdf eof2.pdf

You will get a bounding box error as your second frame is blank but the
newly created .pdf looks fine.

You can wrap this into a NCL script by deleting the workstation and using
the system procedure:

plot = gsn_csm_contour_map(wks,.....
delete(wks)
system("convert -trim +repage eof.pdf eof2.pdf")
system("rm eof.pdf")
end

Hope that helps. If not, please respond to the ncl-talk email list.
Adam


On Wed, Mar 16, 2016 at 8:57 PM, Adv <advita6 at gmail.com> wrote:

>
>
>
> Hi,
> I don't know how to get rid of white spaces around the boundary. Could
> someone help me to fix this? I have attached a output figure for your
> review.
>
> Thanks
>
>
> latS   =  40.
>   latN   =  49.
>   lonL   = -116.
>   lonR   =  -90.
>
>
> wks = gsn_open_wks("pdf","eof")
>   gsn_define_colormap(wks,"BlWhRe")       ; choose colormap
>   plot = new(neof,graphic)                ; create graphic array
>                                           ; only needed if paneling
> ; EOF patterns
>
>   res                      = True
>   res at gsnDraw              = False        ; don't draw yet
>   res at gsnFrame             = False        ; don't advance frame yet
>
> ;---This resource not needed in V6.1.0
>   res at gsnSpreadColors      = True         ; spread out color table
>
>   res at gsnAddCyclic         = False        ; plotted dataa are not cyclic
>
>   res at mpFillOn             = False        ; turn off map fill
> res at mpLimitMode           = "LatLon"
>   res at mpMinLatF            = latS         ; zoom in on map
>   res at mpMaxLatF            = latN
>   res at mpMinLonF            = lonL
>   res at mpMaxLonF            = lonR
>  res at cnFillOn             = True         ; turn on color fill
>   res at cnLinesOn            = False        ; True is default
> ;res at cnLineLabelsOn       = False        ; True is default
>   res at lbLabelBarOn         = False        ; turn off individual lb's
>  res at mpPerimOn              = True                    ; draw box around
> map
> res at mpGeophysicalLineThicknessF = 3.0
> res at mpGeophysicalLineColor = "Black"; (/22/)
> ;res at mpNationalLineThicknessF  = 3.0
> res at mpOutlineBoundarySets = "GeophysicalAndUSStates" ; add state
> boundaries
> res at mpNationalLineColor  = res at mpGeophysicalLineColor
> res at mpUSStateLineThicknessF = 3.0
> res at mpUSStateLineColor  = res at mpGeophysicalLineColor
>
>
>                                           ; set symmetric plot min/max
>   symMinMaxPlt(eof, 16, False, res)       ; contributed.ncl
> ; panel plot only resources
>   resP                     = True         ; modify the panel plot
>   resP at gsnMaximize         = False         ; large format
>   resP at gsnPanelLabelBar    = True         ; add common colorbar
>   resP at lbLabelAutoStride   = True         ; auto stride on labels
>
>   yStrt                    = yyyymm(0)/100
>   yLast                    = yyyymm(nyrs-1)/100
> ;  resP at txString            = "SLP: "+season+": "+yStrt+"-"+yLast
>
> ;*******************************************
> ; first plot
> ;*******************************************
>   do n=0,neof-1
>      res at gsnLeftString  = "EOF "+(n+1)
>      res at gsnRightString = sprintf("%5.1f", eof at pcvar(n)) +"%"
>      plot(n)=gsn_csm_contour_map_ce(wks,eof(n,:,:),res)
>   end do
> ;*******************************************
> ; second plot
> ;*******************************************
> ; EOF time series  [bar form]
>
>   rts           = True
>   rts at gsnDraw   = False       ; don't draw yet
>   rts at gsnFrame  = False       ; don't advance frame yet
>   rts at gsnScale  = True        ; force text scaling
>
> ; these four rtsources allow the user to stretch the plot size, and
> ; decide exactly where on the page to draw it.
>
>   rts at vpHeightF = 0.40        ; Changes the aspect ratio
>   rts at vpWidthF  = 0.85
>   rts at vpXF      = 0.10        ; change start locations
>   rts at vpYF      = 0.75        ; the plot
>
>
>   rts at tiYAxisString = "mm/day"     rts at gsnYRefLine           =
> 0.              ; reference line
>   rts at gsnXYBarChart         = True            ; create bar chart
>   rts at gsnAboveYRefLineColor = "red"           ; above ref line fill red
>   rts at gsnBelowYRefLineColor = "blue"          ; below ref line fill blue
>
> ; panel plot only resources
>   rtsP                      = True            ; modify the panel plot
>   rtsP at gsnMaximize          = True            ; large format
>   rtsP at txString             = "Prec: "+season+": "+yStrt+"-"+yLast
>
>   year = yyyymm/100
>
> ; create individual plots
>   do n=0,neof-1
>      rts at gsnLeftString  = "EOF "+(n+1)
>      rts at gsnRightString = sprintf("%5.1f", eof at pcvar(n)) +"%"
>      plot(n) = gsn_csm_xy (wks,year,eof_ts(n,:),rts)
>   end do
>   gsn_panel(wks,plot,(/neof,1/),rtsP)     ; now draw as one plot
> end
>
>
>
>
> _______________________________________________
> 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/20160317/2d1a9074/attachment.html 


More information about the ncl-talk mailing list