[ncl-talk] legend colorfil problem

Marston Johnston shejo284 at gmail.com
Sat Jun 10 07:40:11 MDT 2017


Hi,

 

I’m trying to get the legend on a xy plot to not show the gridlines by adding the following:

 

lgres at lgPerimFillColor   = "yellow"

lgres at lgPerimFill        = "SolidFill"

 

I’m doing this inside gsn_legend_ndc because I want the legend on plot(3) only:

 

  lgres                    = True

  lgres at lgLineColors       = (/"blue","black","red","blue","black","red"/)

  lgres at vpWidthF           = 0.15                   ; width of legend (NDC)

  lgres at vpHeightF          = 0.1                   ; height of legend (NDC)

  lgres at lgDashIndexes      = (/0,0,0,2,2,2/)              ; dash indexes

  lgres at LgLineThicknessF   = 2.0

  lgres at lgPerimFillColor   = "yellow"

  lgres at lgPerimFill        = "SolidFill"

  gsn_legend_ndc(wks,6,(/"MCH1","MCH2","MCH3","OCH1","OCH2","OCH3"/),0.6,0.2,lgres)

 

I can change the background color but the ”SolidFill” doesn’t seem to work. I’m calling  gsn_legend_ndc before the 

gsn_panel. Is this an issue where the plot is being added after the legend? I’ve looked at the tmGridDrawOrder but this doesn’t seem to work for gridlines in a xy plot. 

 

I’m using NCL version 6.4. Here’s the entire plot sequence:

 

  res = True

  res at gsnDraw = False

  res at gsnFrame = False

  res at tmXMajorGrid = True

  res at tmXMajorGridThicknessF = 1.0

  res at tmXMajorGridLineDashPattern = 2

  res at tmYMajorGrid = True

  res at tmYMajorGridThicknessF = 1.0

  res at tmYMajorGridLineDashPattern = 2

  res at xyLineColors = (/"blue","black","red","blue","black","red"/)

  res at xyLineThicknesses = (/1,1,1,1,1,1/)*2

  res at xyDashPatterns = (/0,0,0,2,2,2/)

  ;res at tiYAxisString = "~F8~T~B~B~N~ (K)"

  res at vpHeightF = 0.5

  res at vpWidthF = 1.5

  res at trXMinF = -90.0

  res at trXMaxF = 90.0

 

  res at trYMinF = 230.0

  res at trYMaxF = 280.0

 

  plot(0) = gsn_csm_xy(wks,zmas&lat,dataas,res)

  plot(1) = gsn_csm_xy(wks,zmas&lat,datacs,res)

 

  res at trYMinF = -4.0

  res at trYMaxF = 0.0

  res at tiXAxisString = "Latitude"

  plot(2) = gsn_csm_xy(wks,zmas&lat,datace,res)

 

  lgres                    = True

  lgres at lgLineColors       = (/"blue","black","red","blue","black","red"/)

  lgres at vpWidthF           = 0.15                   ; width of legend (NDC)

  lgres at vpHeightF          = 0.1                   ; height of legend (NDC)

  lgres at lgDashIndexes      = (/0,0,0,2,2,2/)              ; dash indexes

  lgres at LgLineThicknessF   = 2.0

  lgres at lgPerimFillColor   = "yellow"

  lgres at lgPerimFill        = "SolidFill"

  gsn_legend_ndc(wks,6,(/"MCH1","MCH2","MCH3","OCH1","OCH2","OCH3"/),0.6,0.2,lgres)

 

  resP = True

  resP at gsnMaximize = True

  resP at gsnPanelFigureStrings = str_upper((/"a","b","c"/))

  resP at gsnPanelFigureStringsFontHeightF = 0.01

  resP at amJust = "TopLeft"

  resP at gsnPanelBottom  = 0.05

  gsn_panel(wks,plot,(/3,1/),resP)

 

 

Thanks for your advice/help with this,

/M

   

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Marston S. Johnston, PhD

Department of Earth Sciences

University of Gothenburg, Sweden

Email: marston.johnston at gu.se

SkypeID: marston.johnston 

Phone: +46-31-7864901 

Only the fruitful thing is true!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170610/5b0ec325/attachment.html 


More information about the ncl-talk mailing list