Graph GnuPlot中的线条图,其中线条颜色是我的数据文件中的第三列?
我有一个如下所示的数据文件:Graph GnuPlot中的线条图,其中线条颜色是我的数据文件中的第三列?,graph,plot,gnuplot,Graph,Plot,Gnuplot,我有一个如下所示的数据文件: 1 1.0 0 2 1.5 0 3 0.0 1 4 1.2 2 5 1.0 1 6 1.1 1 其中第一列是我的X值,第二列是我的Y值,第三列是颜色。我想根据第三列给每个线段上色。因此,前两条线段将是“颜色1”,下一条线段将是“颜色2”,下一条线段将是“颜色3”,最后两条线段将再次是“颜色1” 我试过: plot 'file.dat' using 1:2:3 with lines rgb variable; 但我的线路全黑了 这在gnuplot中可能吗 谢谢,
1 1.0 0
2 1.5 0
3 0.0 1
4 1.2 2
5 1.0 1
6 1.1 1
其中第一列是我的X值,第二列是我的Y值,第三列是颜色。我想根据第三列给每个线段上色。因此,前两条线段将是“颜色1”,下一条线段将是“颜色2”,下一条线段将是“颜色3”,最后两条线段将再次是“颜色1”
我试过:
plot 'file.dat' using 1:2:3 with lines rgb variable;
但我的线路全黑了
这在gnuplot中可能吗
谢谢,
Gabe以下内容适合我(gnuplot 4.4) 希望这有帮助 当我运行代码时,gnuplot无法通过“rgb”部分 有关使用变量标记的示例,请参见类似问题: 下面是一些有用的例子: 祝你一切顺利 汤姆 或缩写为:
plot 'foo.dat' w l lc var
很久以前就有人问过这个问题,但我也有同样的问题。获取“可变”颜色的图例/标题的最合适方法是:
# set this to the range of your variable which you want to color-encode
# or leave it out
set cbrange [0:1]
# define the palette to your liking
set palette defined ( 0 "#B0B0B0", 0.333 "#FF0000", 0.666 "#0000FF", 1.0 "#000000" )
# in this example, column 3 is mapped to the colors of the palette
plot "data.txt" u 1:2:3 w l lc palette z
(在gnuplot 4.6 patchlevel 4上测试)您是否知道如何为“可变”颜色创建图例/标题?
plot 'foo.dat' w l lc var
# set this to the range of your variable which you want to color-encode
# or leave it out
set cbrange [0:1]
# define the palette to your liking
set palette defined ( 0 "#B0B0B0", 0.333 "#FF0000", 0.666 "#0000FF", 1.0 "#000000" )
# in this example, column 3 is mapped to the colors of the palette
plot "data.txt" u 1:2:3 w l lc palette z