Re: Map legend adjustment

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Wed Jun 20 2012 - 14:53:33 MDT

Hi Noel,
Yes. Take a look at the nice_mnmxintvl function:
http://www.ncl.ucar.edu/Document/Functions/Built-in/nice_mnmxintvl.shtml

Specifically, look at example 1. Your coding could look like this:

do plt=0,2
minX =
min(x(statID,{regBnds(1,0):regBnds(1,1)},{regBnds(1,2):regBnds(1,3)}))
maxX =
max(x(statID,{regBnds(1,0):regBnds(1,1)},{regBnds(1,2):regBnds(1,3)}))
maxLev = 18
mnmxint = nice_mnmxintvl(minX, maxX, maxLev, False)
....
res1 = True
....
res1@cnLevelSelectionMode = "ManualLevels"
res1@cnMinLevelValF = mnmxint(0)
res1@cnMaxLevelValF = mnmxint(1)
res1@cnLevelSpacingF = mnmxint(2)

Note that for the calculation of minX and maxX I specify only your
region of interest. I am assuming x has one dimensional
latitudes/longitudes, and that the longitudes specified in regBnds are
within the range of longitudes found in x. If they are not you can
(likely) use lonFlip on x to match them.

Good luck, Adam

On 6/20/12 2:04 PM, Noel Aloysius wrote:
> Hello NCL-Talk,
>
> I created a plot that shows three statistics of an output spatially.
> The analysis is done globally, but I specify a region of interest in
> the plot.
>
> The legend is scaled to the max and min of the global values. I want
> to change the scale to the regional values. For example, in the
> attached plot, the max and min values in the legend are 400 and 4,000
> whereas in the region the max and min are 400 and 2,500.
>
> Is there a way I can modify the plot resources and change the legend
> scale? I have appended the plot resources part of the script.
>
> Thanks,
>
> --------------------------------------
> wks = gsn_open_wks("png", diro + "annualAvg_precip_1971-2000")
> plot = new(3, graphic)
>
> statID = 0 ; takes values 0 (mean), 1 (std. dev) and 2 (skewness)
> do plt=0,2
> ;------------- resource list for 1st plot
> res1 = True
> res1@gsnDraw = False
> res1@gsnFrame = False
> res1@gsnStringFontHeightF = 0.0125
> res1@gsnSpreadColors = True
>
> res1@lbOrientation = "Vertical"
> res1@lbLabelFontHeightF = 0.02
> res1@pmLabelBarOrthogonalPosF = -0.025
> res1@lbLabelAutoStride = True
> res1@gsnSpreadColors = True ; not needed in NCL
> v6.1.0
> res1@cnFillOn = True
> res1@cnLinesOn = False
> res1@cnLineLabelsOn = False
>
> ;res1@mpCenterLonF = 26.0 ; center the
> map arounf this lon.
> res1@mpMinLatF = regBnds(1,0) ; select a
> subregion
> res1@mpMaxLatF = regBnds(1,1)
> res1@mpMinLonF = regBnds(1,2)
> res1@mpMaxLonF = regBnds(1,3)
> res1@gsnAddCyclic = False
>
> res1@mpFillOn = False
> res1@mpOutlineBoundarySets = "National"
> res1@mpPerimOn = True
> res1@mpDataBaseVersion = "MediumRes"
> res1@DataSetName = "Earth..4"
> res1@mpOceanFillColor = 1
>
> res1@gsnPaperOrientation = "auto"
> res1@gsnMaximize = True
>
> ;plot(plt) = gsn_csm_contour_map_ce(wks,
> lonFlip(Pstats(statID,:,:)), res1)
> plot(plt) = gsn_csm_contour_map_ce(wks, lonFlip(x(statID,:,:)), res1)
> statID = statID + 1
>
> end do
>
> pres = True ; Set panel resources.
> pres@gsnPanelLabelBar = False ; Turn on panel labelbar.
> ;pres@lbLabelStride = 2 ; print every label marker
> ;pres@lbLabelFontHeightF = 0.010 ; label font height
> pres@gsnFrame = False ; do not advance the frame
> gsn_panel(wks,plot,(/3,1/),pres)
>
> frame(wks)
> ------------------------------------------------------------------------------------------------------------
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jun 20 14:53:43 2012

This archive was generated by hypermail 2.1.8 : Mon Jun 25 2012 - 09:57:23 MDT