[ncl-talk] legend colorfil problem

Marston Johnston shejo284 at gmail.com
Mon Jun 12 10:13:12 MDT 2017


Hi Mary,

 

Thanks for the response. I think I’ll try Adam’s example but I was wondering if I’m using a panel plot, do I do this after the

Panel plot command?

 

Best,

/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!

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

 

 

From: Mary Haley <haley at ucar.edu>
Date: Monday, 12 June 2017 at 16:53
To: Marston Johnston <shejo284 at gmail.com>
Cc: NCL Talk <ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] legend colorfil problem

 

Hi Marston,

 

There are two things you can try.

 

One is to use the new simple_legend function that Adam Phillips added.  See examples leg_16.ncl and leg_17.ncl at:

 

http://www.ncl.ucar.edu/Applications/legend.shtml#ex16

 

The second is I can give you a beta version of 6.5.0 that has the tmGridDrawOrder resource.  This allows you to make the grid lines draw in an earlier phase than the legend.  See example leg_18.ncl on the same page.

 

--Mary

 

 

On Sat, Jun 10, 2017 at 7:40 AM, Marston Johnston <shejo284 at gmail.com> wrote:

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!

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

 


_______________________________________________
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/20170612/c095b920/attachment.html 


More information about the ncl-talk mailing list