|
From: Thomas S. <t.s...@fz...> - 2009-02-13 08:18:44
|
either define your own color palette, e.g.:
set palette functions 0,(gray>0.5?1.:0.),(gray<=0.5?1.:0.)
or reduce the number of colors:
set palette maxcolors 2
the actual palette can be viewed with
test palette
ranlot wrote:
>
> Imagine you have a file with 3 columns: x y z. The goal is to make a 2d
> plot of x and y with a color according to the z value. I've been able to
> do that with the 'set palette' command. This always involves some
> interpolation in the color spectrum to make it continuous.
> Is it possible to keep a discrete set of colors instead? (For example z =
> 0 would be blue and z = 1 would be green without some sort of
> interpolation)
>
--
View this message in context: http://www.nabble.com/Coloring-2D-data-points---No-palette-interpolation-tp21958296p21991997.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|
|
From: Thomas S. <t.s...@fz...> - 2009-02-14 09:27:00
|
cbrange is mapped to the gray intervall from 0.0 to 1.0, so the color functions work in this range. to get higher z-values, define cbrange: zmin=1.5 zmax=6.5 # a mapping function needed to calculate the color zval(x)=(x-zmin)/(zmax-zmin) # set cbrange [zmin:zmax] # color functions green(x)=x<=zval(2.5)?1.0:(x>zval(4.5)&&x<=zval(5.5)?1.0:0.0) red(x)=x>zval(2.5)&&x<=zval(3.5)?1.0:(x>zval(4.5)?1.0:0.0) blue(x)=x>zval(3.5)&&x<=zval(4.5)?1.0:(x>zval(5.5)?1.0:0.0) # set palette functions red(gray),green(gray),blue(gray) test palette # an example plot splot [0:4] [0:4] x+y with pm3d ranlot wrote: > > Really helpful. How would you modify this piece of code to include colors > for z values higher than 1. For example: > z = 2 --> green > z = 3 --> red > z = 4 --> blue > z = 5 --> something else > z = 6 --> yet even another color. > > > Thomas Sefzick wrote: >> >> >> set palette functions 0,(gray>0.5?1.:0.),(gray<=0.5?1.:0.) >> >> > > -- View this message in context: http://www.nabble.com/Coloring-2D-data-points---No-palette-interpolation-tp21958296p22010723.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: antarctidaonline <ant...@ya...> - 2010-02-04 11:03:14
|
Please explain me something about keyword "palette". I have the same task as user ranlot in the very first message. So, for example, I have such file, with name "1.txt": 10 5 3 20 8 2 30 6 1 40 9 0 I read documentation and wrote such a script: set encoding koi8r set border set xtics border set mxtics set ytics axis set grid xtics ytics set xrange [0:50] set yrange [0:10] set palette model RGB maxcolors 4 set palette defined ( 0 "blue", 1 "green", 2 "yellow", 3 "red" ) plot '1.txt' using 1:2:3 with points pointtype 5 palette pause mouse Well, I get such an image: http://old.nabble.com/file/p27451009/Pict.jpg All points are yellow! It is because z coordinates of points are all in interval from 0 to 5, wich belongs to yellow color. But how I can change this intervals? I need all points to be different colors. And - what I need to write to delete "color legend" at right side of graph? And, of course, I use Windows version of gnuplot 4.2. -- View this message in context: http://old.nabble.com/Coloring-2D-data-points---No-palette-interpolation-tp21958296p27451009.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: Thomas S. <t.s...@fz...> - 2010-02-04 11:31:36
|
set cbrange [0:3] see: http://www.gnuplot.info/docs/node214.html unset colorbox see: http://www.gnuplot.info/docs/node167.html antarctidaonline wrote: > > Please explain me something about keyword "palette". I have the same task > as user ranlot in the very first message. So, for example, I have such > file, with name "1.txt": > > 10 5 3 > 20 8 2 > 30 6 1 > 40 9 0 > > I read documentation and wrote such a script: > > set encoding koi8r > > set border > set xtics border > set mxtics > set ytics axis > > set grid xtics ytics > > set xrange [0:50] > set yrange [0:10] > > set palette model RGB maxcolors 4 > set palette defined ( 0 "blue", 1 "green", 2 "yellow", 3 "red" ) > > plot '1.txt' using 1:2:3 with points pointtype 5 palette > pause mouse > > Well, I get such an image: > http://old.nabble.com/file/p27451009/Pict.jpg > All points are yellow! It is because z coordinates of points are all in > interval from 0 to 5, wich belongs to yellow color. But how I can change > this intervals? I need all points to be different colors. And - what I > need to write to delete "color legend" at right side of graph? > And, of course, I use Windows version of gnuplot 4.2. > -- View this message in context: http://old.nabble.com/Coloring-2D-data-points---No-palette-interpolation-tp21958296p27451287.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: antarctidaonline <ant...@ya...> - 2010-02-04 13:15:03
|
Thomas Sefzick wrote quite right answer. set cbrange [0:3] - it works. Thank you! -- View this message in context: http://old.nabble.com/Coloring-2D-data-points---No-palette-interpolation-tp21958296p27452173.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |