Re: Two legends for Four lines ?

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Nov 17 2011 - 11:44:56 MST

Helen,

Please see example 13 on the legend page:

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

This example is probably a bit of overkill for what you need,
for it tries to recreate an XY legend from scratch.

Note that this XY plot has four curves, but I only created
two legend items. See the "NumberLegendItems"
attribute in this code.

--Mary

On Nov 17, 2011, at 6:16 AM, Helen Parish wrote:

> Does anyone know if there is a way to plot legends for only some of
> the lines on a plot ?. I have four lines in the example below, which
> shows a section of the NCL code. I want to put legends on the plot for
> only two of these lines. For the other two lines I do not want any
> part of the legend to appear. I tried just putting "" for one of the
> legend labels I did not want, which removed the writing, but still
> left a colored line for the legend. I also tried omitting the fourth
> label in the ExplicitLegendLabels assignment, but this still left a
> colored line and put rubbish in the written part of the legend.
>
> Is there a way to create legends for just 2 of the 4 lines ?.
>
> Thanks,
> Helen.
>
>
>
> Below is an excerpt from the routine :
>
>
> res@xyLineColors =
> (/"black","blue","red","red"/) ; change line colour
>
> res@xyDashPatterns = (/0,1,2,2/) ;
> choose dash patterns
>
> res@xyLineThicknesses = (/1.0,2.0,2.0,2.0/) ;
> make 2nd, 3rd, 4th lines thicker
>
> ; add a legend
> res@pmLegendDisplayMode = "Always" ; turn on legend
>
> res@pmLegendSide = "Top" ; Change location
> of
> res@pmLegendParallelPosF = .80 ; move units right
> res@pmLegendOrthogonalPosF = -0.275 ; more neg = down
>
> res@pmLegendWidthF = 0.12 ; Change width and
> res@pmLegendHeightF = 0.10 ; height of legend.
> res@lgLabelFontHeightF = .02 ; change font
> height
> res@lgPerimOn = False ; no box around
> ; labels for the legend
> res@xyExplicitLegendLabels = (/"","Mean","Standard deviation"/)
>
> plot = gsn_csm_xy (wks,x,y,res) ; create plot
>
> _______________________________________________
> 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 Nov 17 11:45:05 2011

This archive was generated by hypermail 2.1.8 : Thu Nov 17 2011 - 11:50:12 MST