1

this is the first time that I use gnuplot . Therefore my question may be so obvious to solve but I could not figure it out. (I've already search on both stackoverflow and internet)

Now I need to plot number of dots on the plot and my file is like that:

dots-Xcoord dots-Ycoord Color_of_dot

> example:  
 1.1 0.234 "black"
 2.15 3.1 "black"
 1.76 0.94 "black"
 3.15 6.12 "blue"
 3.66 2.14 "blue"

So, to draw these dots on the graph I typed the following commands( non of them worked):

plot 'test.dat' using 1:2:3 with points pointtype 7 pointsize 1 lc variable

plot 'test.dat' using 1:2:3 with points pointtype 7 pointsize 1 lc 3

However when I type the command like that: plot 'test.dat' using 1:2 with points pointtype 7 pointsize 1 lc "black" It works. So my question is that how could I assign color of a dot from a file?

  • You cannot read a color *name* from a data file, but either a line type index, when using `lc var`, so you must define appropriate line types. Or you give an integer value of a color when using `lc rgb var`, like `255*255**2` for red. – Christoph May 16 '15 at 14:49
  • @Christoph should I give 3 values of rgb at seperate colomns? – sprite sirince May 16 '15 at 14:50
  • That would be one option, see also http://stackoverflow.com/a/25865589/2604213, or http://stackoverflow.com/a/26539489/2604213 – Christoph May 16 '15 at 14:51

1 Answers1

0

For change the color, you have to write rgb before the color:

plot 'test.dat' using 1:2 with points pointtype 7 pointsize 1 lc rgb "black"

or even:

plot 'test.dat' using 1:2 with points pointtype 7 pointsize 1 lc rgb "#FF0000"

by writing any color hex (just google the code of the color you want to)

Cami
  • 1