Re: Labelbar problem in panel plot

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Apr 26 2012 - 14:24:50 MDT

Hi Imogen,

With NCL V6.0.0 and earlier, you can only have one color map per frame (or page) of graphics, unless you draw the plot *before* you change the color map for the next plot.

In your case, you are creating several plots and drawing them all later with gsn_panel, so whatever the last color table you set, will be the one used for all plots.

In the next release of NCL, this will no longer be an issue! You will be able to use multiple color tables on a single page.

Meanwhile, you can get around this by doing the paneling yourself. Please see the attached script. If you set DO_PANEL_MYSELF to True, then the script will do the paneling by setting the vpHeightF/vpWidthF/vpXF/vpYF resources.

--Mary

On Apr 26, 2012, at 8:47 AM, Imogen Fletcher wrote:

> Hi everyone,
>
> I've created a panel plot consisting of 6 maps, each using a different
> colour table, based on the example panel_26.ncl from
> http://www.ncl.ucar.edu/Applications/panel.shtml . Below is the relevant
> part of the script (the data files are too big to attach here and
> involve a lot of modification at the beginning of the script).
>
> The problem I'm having is that each dataset has a different scale, and I
> want to manually set the levels and the colours for each map, so that
> certain colours fall at certain values (eg white at 0, red for negative
> values etc.) I've attached what I've managed to produce so far, so
> hopefully this question will make sense!
>
> If anyone has any suggestions of a way to achieve this, it would be much
> appreciated!
>
> Thanks,
> Imogen
>
>
> wks = gsn_open_wks("png","dsl_npp_fire_mean_trend")
>
> res = True
> res@gsnDraw = False
> res@gsnFrame = False
>
> res@cnFillMode = "RasterFill"
> res@gsnAddCyclic = True
> res@mpOutlineOn = True
> res@mpPerimOn = False
> res@lbLabelBarOn = True
>
> res@gsnLeftString = ""
> res@gsnRightString = ""
>
> res@cnLinesOn = False
> res@cnFillOn = True
> res@gsnSpreadColors = True
>
> res@cnLevelSelectionMode = "AutomaticLevels"
>
>
> nplots = 6
> plots = new(nplots,graphic)
>
> colormaps =
> (/"WhiteBlue","GreenYellow","WhiteYellowOrangeRed","BlWhRe","BlWhRe","BlWhRe"/)
> do n=0,nplots-1
> gsn_define_colormap(wks,colormaps(n))
> plots(n) = gsn_csm_contour_map(wks,data(n,:,:),res)
> end do
>
> pres = True
> pres@gsnMaximize = False
> pres@gsnFrame = False
> pres@gsnPanelLabelBar = False
> pres@pmLabelBarWidthF = 1
>
> pres@gsnDraw = False
>
> pplots = gsn_panel_return(wks,plots(0),(/1,1/),pres)
>
>
> pres@gsnDraw = True
> pres@gsnPanelLeft = 0.
> pres@gsnPanelRight = 0.45
> pres@gsnPanelTop = 1.
>
>
> pres@gsnPanelFigureStringsPerimOn = False
> pres@gsnPanelFigureStringsFontHeightF = 0.01
> pres@amJust = "TopLeft"
>
> fig_strs = (/"DSL mean","NPP mean","Fire count mean","DSL trend","NPP
> trend","Fire count trend"/)
>
> do n=0,2
> gsn_define_colormap(wks,colormaps(n))
> pres@gsnPanelFigureStrings = fig_strs(n)
> pres@gsnPanelTop = 1-n*0.4
> gsn_panel(wks,plots(n),(/1,1/),pres)
> pres@txString = ""
> end do
>
> pres@gsnPanelLeft = 0.5
> pres@gsnPanelRight = 0.95
> pres@gsnPanelTop = 1.
>
> do n=3,5
>
> gsn_define_colormap(wks,colormaps(n))
> pres@gsnPanelFigureStrings = fig_strs(n)
> pres@gsnPanelTop = 1-(n-3)*0.4
> gsn_panel(wks,plots(n),(/1,1/),pres)
> res@gsnSpreadColors = True
> pres@txString = ""
> end do
>
> frame(wks)
>
>
> <dsl_npp_fire_mean_trend.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 Thu Apr 26 14:24:57 2012

This archive was generated by hypermail 2.1.8 : Mon Apr 30 2012 - 09:21:12 MDT