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

Dennis Shea shea at ucar.edu
Thu Mar 17 15:43:12 MDT 2016


Do a

  printVarSummary(eof)

Look at your min/max lat and lon coordinates associated with 'eof'.
Do they match your specified map limite. I speculate not. NCL plots the
region you specified. The data are placed in this region

Replace

  latS   =  40.
  latN   =  49.
  lonL   = -116.
  lonR   =  90.

  nlat = dimsizes(eof&lat)    ; lat==> whatever the coordinate name is
  mlon= dimsizes(eof&lon)

With

  latS = eof&lat(0)
  latN = eof&lat(nlat-1)
  lonL = eof&lon(0)
  lonR = eof&lon(mlon-1)




On Thu, Mar 17, 2016 at 3:31 PM, Adv <advita6 at gmail.com> wrote:

> Hi,
> Thanks for your reply. I think my question is not clear. I would like to
> get rid of white spaces inside the boundary line, not outside. I don't
> understand why its happening here. I never seen it before.  Please help me
> to understand whats going on here. It looks quite awkward and it may
> confuse someone that white spaces are calculated EOF values, since color
> bar includes white color as well.
> Thanks
>
>
>
> On Thu, Mar 17, 2016 at 2:51 PM, Adam Phillips <asphilli at ucar.edu> wrote:
>
>> 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>
>>
>
>
> _______________________________________________
> 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/20160317/feb10e34/attachment.html 


More information about the ncl-talk mailing list