Re: Two legends for Four lines ?

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Nov 17 2011 - 10:12:12 MST

Hi Helen,

The legend object that's associated with an XY plot that you create is
not very customizable in this fashion. I was able to turn off the
labels the same way you did, but instead of setting
xyExplicitLegendLabels to 2 elements, I set it to four elements,
with the last two being equal to "". This way you don't get the
label rubbish.

However, you can't turn off the individual lines.

I will write an example script that shows how to customize your legend.

--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 10:12:18 2011

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