## [Gnuplot-info] Re: different colors on the same curve

 [Gnuplot-info] Re: different colors on the same curve From: Gavin Buxton - 2006-01-27 09:37:11 ```Hi, Its really very simple (although you might run out of colours if you have 'tens of files') You split it up just as someone mentioned, but like this: plot 'data.dat' u 1:(x<100?\$2:1/0),/ '' u 1:(x>100&&x<200?\$2:1/0),/ '' u 1:(x>200&&x<300?\$2:1/0),/ '' u 1:(x>300&&x<400?\$2:1/0),/ '' u 1:(x>400&&x<500?\$2:1/0),/ '' u 1:(x>500&&x<600?\$2:1/0) for example would allow you to plot the sections as different plots. You can specify colours using the with line (w l) option from plot (see help plot), but this is going to depend on which terminal your using. Hope this helped, Gavin. > Hello, > i want to plot a curve with different colors. For > example, if the Xrange is > [0:500], i want that between [0:100] the curve is in > red (for example), > between [100:200] the curve is in green, between > [200:300] the curve is in > red again... and so on. > How can i do this? > thank you > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ```

 Re: [Gnuplot-info] different colors on the same curve From: Tammo Heeren - 2006-01-26 14:29:23 ```How about you split the curve up into section? Try this: f(x) = sin(x) set xrange [0:pi] plot x<=pi/4 ? f(x) : 1/0 with lines lt 0,\ x>pi/4 && x<=pi/2 ? f(x) : 1/0 with lines lt 1,\ x>pi/2 && x<=3*pi/4 ? f(x) : 1/0 with lines lt 2,\ x>3*pi/4 && x<=pi ? f(x) : 1/0 with lines lt 3 This should get you started. Tammo On 26 Jan 2006 at 4:37, chedly ghedira wrote: > > Hello, > i want to plot a curve with different colors. For example, if the Xrange is [0:500], i want that > between [0:100] the curve is in red (for example), between [100:200] the curve is in green, > between [200:300] the curve is in red again... and so on. > How can i do this? > thank you ```
 [Gnuplot-info] Re: different colors on the same curve From: Gavin Buxton - 2006-01-27 09:37:11 ```Hi, Its really very simple (although you might run out of colours if you have 'tens of files') You split it up just as someone mentioned, but like this: plot 'data.dat' u 1:(x<100?\$2:1/0),/ '' u 1:(x>100&&x<200?\$2:1/0),/ '' u 1:(x>200&&x<300?\$2:1/0),/ '' u 1:(x>300&&x<400?\$2:1/0),/ '' u 1:(x>400&&x<500?\$2:1/0),/ '' u 1:(x>500&&x<600?\$2:1/0) for example would allow you to plot the sections as different plots. You can specify colours using the with line (w l) option from plot (see help plot), but this is going to depend on which terminal your using. Hope this helped, Gavin. > Hello, > i want to plot a curve with different colors. For > example, if the Xrange is > [0:500], i want that between [0:100] the curve is in > red (for example), > between [100:200] the curve is in green, between > [200:300] the curve is in > red again... and so on. > How can i do this? > thank you > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ```