Two legends for Four lines ?

From: Helen Parish <hparish_at_nyahnyahspammersnyahnyah>
Date: Thu Nov 17 2011 - 06:16:31 MST

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 ?.


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
  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
  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:
Received on Thu Nov 17 06:17:13 2011

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