Re: Adjusting panel panel plot resources

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Jun 29 2012 - 08:13:44 MDT

On Jun 28, 2012, at 6:06 PM, Noel Aloysius wrote:

> Hi NCL,
>
> I created a panel plot with 16 plots (figure attached). I want to
>
> (a) include a single legend for the first three rows and the same legend for the first two plots in the last row

Hi Noel,

We have a few examples that show how to panel multiple plots using different legends (we call them labelbars).

See examples 15, 17, 22, and 26.

http://www.ncl.ucar.edu/Applications/panel.shtml

>
> (b) change the colormap for the last two plot in the last row to a different color scheme.

Example 26 in the above URL uses three different color maps. You need to have V6.1.0-beta
to create this type of example, though.

If you don't have V6.1.0-beta, then the best way to use multiple color tables on one page
is to merge two color maps using gsn_merge_colormaps.

You then will need to set gsnSpreadColorStart and gsnSpreadColorEnd for each set
of plots to indicate where the first color map starts and ends, and same for the second
colormap.

See example 9 at:

http://www.ncl.ucar.edu/Applications/color.shtml

which shows how to change the color map *and* panel the two different plots.

>
> (c) I get a warning message after each plot as below,
>
> warning:DataSetName is not a valid resource in xxxx_contour at this time <- not sure why I get this?

Whenever you see this type of error, "not a valid resource...", it usually means you've misspelled a resource
name, or are applying a resource to the wrong function. In this case, it is misspelled. It should be "mpDataSetName".

Hope this helps.

--Mary

>
> My attempts so far have not yielded the required results.
>
> I appreciate you help on this. The portion of the script is appended below,
>
> ;*******************************************************************
> wks = gsn_open_wks("png", diro + "annualAvg_precip_AllGCMs_1971-2000")
> plot = new(16, graphic)
>
> colors = (/ (/255,255,255/),(/0,0,0/),(/255,255,255/), (/244,255,244/), \
> (/217,255,217/), (/163,255,163/), (/106,255,106/), \
> (/43,255,106/), (/0,224,0/), (/0,134,0/),(/255,255,0/),\
> (/255,127,0/) /) * 1.0
> colors = colors/255.
> gsn_define_colormap(wks, colors)
>
> centerlon = (regBnds(ireg,2) + regBnds(ireg,3)) / 2 ; center the map around this longitude
>
> ;------------- resource list for 1st plot
> res1 = True
> res1@gsnDraw = False
> res1@gsnFrame = False
> res1@gsnPaperOrientation = "auto"
> res1@gsnMaximize = True
> res1@gsnStringFontHeightF = 0.0125
> res1@gsnSpreadColors = True
>
> res1@lbOrientation = "Vertical"
> res1@lbLabelFontHeightF = 0.03
> res1@pmLabelBarOrthogonalPosF = -0.025
> res1@lbLabelAutoStride = True
> res1@gsnSpreadColors = True
> res1@cnFillOn = True
> res1@cnLinesOn = False
> res1@cnLineLabelsOn = False
>
> res1@mpCenterLonF = centerlon ; center the map around this lon.
> res1@mpMinLatF = regBnds(ireg,0) ; select a subregion
> res1@mpMaxLatF = regBnds(ireg,1)
> res1@mpMinLonF = regBnds(ireg,2)
> res1@mpMaxLonF = regBnds(ireg,3)
> res1@gsnAddCyclic = False
>
> res1@mpFillOn = False
> res1@mpOutlineBoundarySets = "National"
> res1@mpPerimOn = True
> res1@mpDataBaseVersion = "MediumRes"
> res1@DataSetName = "Earth..4"
> res1@mpOceanFillColor = 1
>
> do i=0,11
> res1@cnLevelSelectionMode = "ManualLevels"
> res1@cnMinLevelValF = 600
> res1@cnMaxLevelValF = 2400
> res1@cnLevelSpacingF = 100
> res1@gsnRightStringFontHeightF = 0.03
> res1@gsnRightString = gcm_names(i)
> ; advance the plot
> plot(i) = gsn_csm_contour_map_ce(wks,Pann7100(0,i,:,:), res1)
> end do
>
> res1@gsnRightString = "Obs"
> res1@gsnRightStringFontHeightF = 0.03
> plot(12) = gsn_csm_contour_map_ce(wks,Pann7100_obs,res1)
>
> res1@gsnRightString = "bias-corr. GCM-avg"
> plot(13) = gsn_csm_contour_map_ce(wks,Pannstats_bc(0,:,:),res1)
>
> delete([/res1@cnLevelSelectionMode,res1@cnMinLevelValF,res1@cnMaxLevelValF,res1@cnLevelSpacingF/])
> delete(res1@cnLevels)
> res1@cnLevelSelectionMode = "ExplicitLevels"
> res1@cnLevels = (/5,10,15,20,25,30,35,40/)
> res1@gsnRightString = "CV"
> res1@gsnRightStringFontHeightF = 0.03
> plot(14) = gsn_csm_contour_map_ce(wks,Pannstats_bc(1,:,:),res1)
>
> delete(res1@cnLevels)
> delete([/res1@cnLevelSelectionMode,res1@cnMinLevelValF,res1@cnMaxLevelValF,res1@cnLevelSpacingF/])
> res1@cnLevelSelectionMode = "ExplicitLevels"
> res1@cnLevels = (/-1.0,-0.8,-0.6,-0.4,-0.2,0,0.2,0.4,0.6,0.8,1.0/)
> res1@gsnRightString = "skew"
> res1@gsnRightStringFontHeightF = 0.03
> plot(15) = gsn_csm_contour_map_ce(wks,Pannstats_bc(2,:,:),res1)
>
> ; advance to panel resources
> pres = True ; Set panel resources.
> pres@gsnPanelLabelBar = False ; Turn on panel labelbar.
> pres@gsnFrame = False ; do not advance the frame
> pres@gsnPanelRowSpec = True ; tell panel what order to plot
> pres@gsnPanelCenter = False ; left-ligned plot
> pres@gsnMaximize = True
> gsn_panel(wks,plot,(/4,4,4,4/),pres)
>
> frame(wks)
> delete([/res1,pres,wks,plot/])
> ;*************************************************************************************************************
>
>
> Noel
> <annualAvg_precip_AllGCMs_1971-2000.png>_______________________________________________
> 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 Fri Jun 29 08:13:53 2012

This archive was generated by hypermail 2.1.8 : Fri Jun 29 2012 - 15:46:14 MDT