Re: curve colors

From: Will Hobbs <Will.Hobbs_at_nyahnyahspammersnyahnyah>
Date: Thu Dec 13 2012 - 17:10:49 MST

Ah, that's your problem; NCL uses the xyLineColor (singular) resource ONLY if res@xyMonoLineColor has been set to True.

There's a couple of possible solutions:

First possibility (probably easiest)

> res@xyLineColors = (/"red","green","blue"/)
> plot = gsn_csm_xy(wks,x,y,res)
> res@xyLineColors (0) = "brown" ;only change first element of the colour array
> plot2 = gsn_csm_xy(wks, x2,y2,res) ; single line will be plotted using first element of xyLineColors array

Other possibility

> res@xyLineColors = (/"red","green","blue"/)
> plot = gsn_csm_xy(wks,x,y,res)
>delete(res@xyLineColors) ;don't know if you need to do this, maybe try without for your own interest
>res@xyMonoLineColor = True
> res@xyLineColor = "brown"
> plot2 = gsn_csm_xy(wks, x2,y2,res) ; single line will be plotted using first element of xyLineColors array

Either of these should work

Will

From: cheryl Ma <xiaoyancloud@gmail.com<mailto:xiaoyancloud@gmail.com>>
Date: Friday, 14 December 2012 11:03 AM
To: Will Hobbs <will.hobbs@utas.edu.au<mailto:will.hobbs@utas.edu.au>>
Cc: "ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu> USERS" <ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu>>
Subject: Re: curve colors

Will,

Thanks. In my case, the array of line colors is the NOT in same size.
The first one has 3, and second has 1 only. I tried something as below, but the curve color from the array 2 follow the color for array 1, i.e. red.

 anything wrong?

 res@xyLineColors = (/"red","green","blue"/)
 plot = gsn_csm_xy(wks,x,y,res)

res@xyLineColor = "brown"
 plot2 = gsn_csm_xy(wks, x2,y2,res)

On Thu, Dec 13, 2012 at 3:28 PM, Will Hobbs <Will.Hobbs@utas.edu.au<mailto:Will.Hobbs@utas.edu.au>> wrote:
Cheryl

Just change the xyLineColors resource between plotting the first and second plot. This will work as long as the array of line colors is the same size (if not, you would have to delete() and reset the resource):

> res@xyLineColors = (/"red","green","blue"/)

> plot1 = gsn_csm_xy(wks,x,y,res)

> res@xyLineColors = (/"brown","violet","magenta"/)

> plot2 = gsn_csm_xy(wks, x2,y2,res)

Will

From: cheryl Ma <xiaoyancloud@gmail.com<mailto:xiaoyancloud@gmail.com>>
Date: Friday, 14 December 2012 10:23 AM
To: "ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu> USERS" <ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu>>
Subject: curve colors

Hi all,

I use one set of data to plot 3 curves by call
plot = gsn_xy(wks,x,y,res)

then I want to use another set of data to plot one more curve on the same plot.
plot = gsn_xy(wks,x2,y2,res)

My question is that 3 curve colors have been set in the first call gsn_xy, how to set the different colors to the more curves from the second data set? I tried to set the color by change the color with
res@xyLineColors = (/line_col1,line_col2/)
but this will change the colors for both the data from second sets of data and first sets of data.

Thanks,

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Dec 13 17:11:23 2012

This archive was generated by hypermail 2.1.8 : Fri Dec 21 2012 - 10:43:23 MST