[ncl-talk] Sub: cn labels contradicts with lb label bar..

Kyle Griffin ksgriffin2 at wisc.edu
Mon Mar 21 08:23:32 MDT 2016


When making panel plots, NCL uses the contour settings from the first panel
for the color bar. It makes an assumption that you have explicitly set the
cnLevelSelectionMode and appropriate resources (either cnLevels or
cnMinLevelF/cnMaxLevelF/cnLevelSpacingF) to ensure this consistency between
each panel.

I would suggest manually settings some of these contour level resources to
make your plots consistent and this should fix your problem.


Kyle

On Sun, Mar 20, 2016 at 11:03 PM Adv <advita6 at gmail.com> wrote:

> Hi,
> In second and third spatial plots, cn labels are not consistent with lb
> label bar. There is a shift. I have attached here a figure for your review.
> Could someone help me to resolve this issue?
>
> Thank you
>
> ;**************************************************
> ; plot parameters
> ;**************************************************
>
> wks = gsn_open_wks("pdf","eof")
>   gsn_define_colormap(wks,"BlWhRe")       ; choose colormap
> ;  gsn_define_colormap(wks,"testcmap")       ; 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 mpMinLatF            = eof&lat(0)         ; zoom in on map
>   res at mpMaxLatF            = eof&lat(nlat-1)
> res at mpMinLonF            = eof&lon(0)
>   res at mpMaxLonF            = eof&lon(mlon-1)
>  res at cnFillOn             = True         ; turn on color fill
>   res at cnLinesOn            = True        ; True is default
> ;res at cnLineLabelsOn       = False
>   res at lbLabelBarOn         = False        ; turn off individual lb's
> res at mpGeophysicalLineThicknessF = 3.0
> res at mpGeophysicalLineColor = "Black"; (/22/)
> 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         = True         ; 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            = "Reanalysis_Temp(C) DJF EOF: "+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
>   gsn_panel(wks,plot,(/neof,1/),resP)               ; now draw as one plot
> ;  txres               = True
> ;  txres at txFontHeightF = 0.015
> ;  gsn_text_ndc(wks,"Figure 16: A smaller panel plot",0.5,0.16,txres)
>   frame(wks)
> ;*******************************************
> ; 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 = "deg C"                    ; y-axis label
>  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             = "Reanalysis_Temp(C) DJF EOF "+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+0,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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160321/eed64e35/attachment.html 


More information about the ncl-talk mailing list