简体   繁体   English

如何在 gnuplot 中使用不同的 colors 点 plot

[英]How to plot dots with different colors in gnuplot

this is the first time that I use gnuplot .这是我第一次使用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 inte.net) (我已经在 stackoverflow 和 inte.net 上搜索过了)

Now I need to plot number of dots on the plot and my file is like that:现在我需要 plot plot 上的点数,我的文件是这样的:

dots-Xcoord dots-Ycoord Color_of_dot点-X坐标 点-Y坐标 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.但是,当我键入这样的命令时: plot 'test.dat' using 1:2 with points pointtype 7 pointsize 1 lc "black"它起作用了。 So my question is that how could I assign color of a dot from a file?所以我的问题是如何从文件中分配点的颜色?

For change the color, you have to write rgb before the color:要改变颜色,你必须在颜色前写 rgb :

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

or even:甚至:

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

by writing any color hex (just google the code of the color you want to)通过编写任何颜色的十六进制(只需谷歌你想要的颜色代码)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM