Re: How to split the legend into two groups?

From: <mmkamal_at_nyahnyahspammersnyahnyah>
Date: Fri Apr 05 2013 - 19:23:35 MDT

Dear Mary,

Thank you for creating this example. Yes, that's what I was looking
for. I have applied your example to my case and become successful
except some issues arises. If the total number of time series are not
an integer multiple of the number of labels then the script is not
working (e.g., in my case I have 11 time series which I have splitted
3,3,3 and 2 labels). Below I have included my code for your
convenience (labels not working are commented)

Thanks
Kamal

===================================================

;---Set resources for colors and labels
   colors1 = (/"blue","red","darkgreen"/)
   colors2 = (/"darkorange","olivedrab","brown"/)
   colors3 = (/"peru","tomato","purple"/)
; colors4 = (/"navyblue","black"/)

   labels1 = (/"SAS","BMJ","GD"/)
   labels2 = (/"Tiedtke","MP_Eta","MP_WSM6"/)
   labels3 = (/"MP_Goddard","MP_Thompson","PBL_MRF"/)
; labels4 = (/"PBL_MYJ","PBL_MYNN2"/)

;---Create the four XY plots
   res@xyLineColors = colors1
   res@xyExplicitLegendLabels = labels1
   res@pmLegendParallelPosF = 0.15

   plot1 = gsn_csm_xy(wks,times,data(0:2,:),res)

   res@xyLineColors = colors2
   res@xyExplicitLegendLabels = labels2
   res@pmLegendParallelPosF = 0.37
   plot2 = gsn_csm_xy(wks,times,data(3:5,:),res)

   res@xyLineColors = colors3
   res@xyExplicitLegendLabels = labels3
   res@pmLegendParallelPosF = 0.59
   plot3 = gsn_csm_xy(wks,times,data(6:8,:),res)

; res@xyLineColors = colors4
; res@xyExplicitLegendLabels = labels4
; res@pmLegendParallelPosF = 0.81
; plot4 = gsn_csm_xy(wks,times,data(9:10,:),res)

;---Overlay one plot on the other, so they become one plot.
   overlay(plot1,plot2)
   overlay(plot1,plot3)
; overlay(plot1,plot4)

   draw(plot1) ; This will draw all four plots
   frame(wks)

===============================================================

Quoting Mary Haley <haley@ucar.edu>:

> Hi Kamal,
>
> Something was wrong with my mailer and I could not see your attached plot.
>
> I created an example for you. In order to do what I think you're asking for,
> you need to create separate XY plots, each with a subset of the curves,
> and its own legend. You will need to move the legend to a different place
> so they don't overlap.
>
> Then, you can use te "overlay" procedure to overlay all the plots on
> top of each other.
>
> See example xy_32.ncl (which I've attached) at:
>
> http://www.ncl.ucar.edu/Applications/overlay.shtml#ex32
>
> --Mary
>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Apr 5 19:23:58 2013

This archive was generated by hypermail 2.1.8 : Sun Apr 07 2013 - 21:13:30 MDT