[ncl-talk] Issue Making LabelBars "Transparent" (Blue Gradient Error)
Mary Haley
haley at ucar.edu
Wed Jan 18 11:36:32 MST 2017
Hi Alan,
This is a good question that we currently don't have a good example for, so
I decided to create one. See panel_40.ncl at:
http://www.ncl.ucar.edu/Applications/panel.shtml#e40
I suggest using gsn_attach_plots, so you can more easily attach the four
plots with a labelbar turned on only for the far right plot.
If you want to contribute your own script in place of this one (which uses
dummy data) I'll be happy to do so. I would need your new script, and a
PNG image. This will look better than the dummy data I used.
--Mary
On Tue, Jan 17, 2017 at 3:01 PM, Alan Rhoades <alan.m.rhoades at gmail.com>
wrote:
> [image: Inline image 1]
>
> Hello,
>
> I've been trying to set all of the label bars in my plot above, save for
> the far right plot, to be "transparent" (aka fill everything as white or
> the background color) to preserve an equal space that NCL allocates across
> all plots. If I don't preserve the label bar in a "transparent" way the
> far right plot (UDEL) becomes an awkward size compared to the other 3 plots
> to its left.
>
> However, when I make the label bar "transparent" (see ERA-interim plot) it
> still has a slight blue gradient associated with it.
>
> Any ideas how to eliminate this gradient fill entirely? I have included
> my resource settings below.
>
> I have the following general res@ settings...
>
> ;-------------------------------------------
> ; PLOT RESOURCES
> ;-------------------------------------------
>
> res = True ; plot modifications desired
> res at gsnMaximize = False ; Maximize size of plot in frame
> ; res at gsnSpreadColors = True ; Use full colormap, but start
>
> res at cnFillOn = True ; Turn on contour fill
> res at cnFillMode = "AreaFill" ; Style of fill. You can also
> ; res at cnFillMode = "RasterFill" ; Style of fill. You can also
> ; use "CellFill" and "RasterFill"
> res at cnLinesOn = False ; Turn off contour lines
> res at cnLineLabelsOn = False ; Turn off contour line labels
> res at cnLevelSelectionMode = "ExplicitLevels"
>
> res at lbLabelAutoStride = True ; Clean up labelbar labels.
>
> ; PANEL PLOT SPECIFIC RESOURCES
> res at gsnDraw = False
> res at gsnFrame = False ; don't advance frame
>
> res at mpOutlineBoundarySets = "geophysicalandusstates"; turn on states
> res at cnMissingValFillColor = "white" ; make missing values
> white
> res at mpLandFillColor = -1 ; transparent = -1
>
> ;MOVE TEXT STRINGS IN PLOTS AND SET FONT HEIGHTS
> Font = 0.020 ; best = 0.030
> Position = 0.010
>
> res at tmYLLabelFontHeightF = Font
> res at tmXBLabelFontHeightF = Font
> res at gsnLeftStringFontHeightF = Font
> res at gsnLeftStringOrthogonalPosF = Position ; Move text up or down
> from plot boundary
> res at gsnRightStringFontHeightF = Font
> res at gsnRightStringOrthogonalPosF = Position ; Move text up or
> down from plot boundary
> res at gsnCenterStringFontHeightF = Font
> res at gsnCenterStringOrthogonalPosF = Position ; Move text up or
> down f
>
> ; MODIFY LABELBAR THICKNESS
> res at pmLabelBarHeightF = 0.50 ; make label bar shorter
> res at pmLabelBarWidthF = 0.075 ; make label bar thinner
>
> ; MOVE LABEL BARS AND TITLES BELOW PLOT
> res at lbTitlePosition = "Bottom" ; put it below the plot
>
> overall x-axis
> ; LABELBAR FONT SIZES
> res at lbLabelFontHeightF = Font
> res at lbTitleFontHeightF = Font*0.95 ; 0.95 = best
>
> ; All data is regional
> res at gsnAddCyclic = False
>
> ;MAKE LABELS BLANK
> res at gsnLeftString = "" ; add the gsn titles
> res at gsnCenterString = ""
> res at gsnRightString = ""
>
> ; TURN OFF TICKMARKS AND TOP LABELS FOR SPACING (TURN THEM ON INDIVIDUALLY)
> res at tmXTOn = False ; turn off top labels
> res at tmYROn = False ; turn off right labels
> res at tmXBLabelsOn = False
> res at tmXBOn = False
> res at tmYLLabelsOn = False
> res at tmYLOn = False
>
> ; VERTICAL LABEL BAR ALIGNMENT
> ; res at lbLabelBarOn = False ; turn off labelbar, but still
> customize
> res at lbOrientation = "Vertical" ; it so we can recreate it later
> res at lbTitleAngleF = 90. ; title angle
> res at lbTitlePosition = "Right" ; title location
> res at lbTitleDirection = "Across" ; letter angle
>
> gsn_define_colormap(wks,"WhiteBlueGreenYellowRed")
>
> Levels_TSA = ispan(260,305,5)
> cmap5 = read_colormap_file("t2m_29lev")
> res_TSA = res_westernusa
> res_TSA at cnLevels = Levels_TSA
> res_TSA at lbLabelStrings = sprinti(" %-5i ",Levels_TSA) ; the extra
> spaces are a kludge to force the labelbar
>
> The ERA-Interim plot res@ settings are...
>
> ;-----------------------------------------
> ; REGIONAL PLOT
> ;-----------------------------------------
>
> res_regional_${data}_${var}_${months} = res_TSA
> res_regional_${data}_${var}_${months}@tmYLOn = True
> res_regional_${data}_${var}_${months}@tmYLLabelsOn = True
> res_regional_${data}_${var}_${months}@lbLabelAutoStride = False
> ; Clean up labelbar labels.
> res_regional_${data}_${var}_${months}@lbMonoFillPattern = True
> ; fill sold
> res_regional_${data}_${var}_${months}@lbMonoFillColor = True
> ; fill sold
> res_regional_${data}_${var}_${months}@lbFillBackground = "white"
> res_regional_${data}_${var}_${months}@lbFillColors = "white"
> res_regional_${data}_${var}_${months}@lbBoxLineColor = "white"
> res_regional_${data}_${var}_${months}@lbLabelFontColor = "white"
> ; res_regional_${data}_${var}_${months}@pmLabelBarOrthogonalPosF = 0.00
> res_regional_${data}_${var}_${months}@gsnLeftString = "ERA-Interim"
> res_regional_${data}_${var}_${months}@gsnRightString = " 1985-2015 "
> res_regional_${data}_${var}_${months}@gsnCenterString = ""
> plot_regional_${data}_${var}_${months} = gsn_csm_contour_map_ce(wks,${
> data}_${var}_${months},res_regional_${data}_${var}_${months})
>
> AR
>
> --
>
> *Alan Rhoades | **PhD Candidate | **University of California, Davis*
> *Atmospheric Science Graduate Group | **Climate Change Water and Society
> (CCWAS) NSF IGERT Trainee*
> *alan.m.rhoades at gmail.com
> <alan.m.rhoades at gmail.com> | amrhoades at ucdavis.edu <amrhoades at ucdavis.edu>*
> *Website <http://alanrhoades.weebly.com/> | Research Gate
> <https://www.researchgate.net/profile/Alan_Rhoades> | LinkedIn
> <https://www.linkedin.com/pub/alan-rhoades/22/5bb/52a>** | **Google
> Scholar <https://scholar.google.gr/citations?user=AVFLiFsAAAAJ&hl=en>*
>
>
>
>
> _______________________________________________
> 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/20170118/ad70a95e/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 208740 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170118/ad70a95e/attachment.png
More information about the ncl-talk
mailing list