GnuPlot 中的线条图,其中线条颜色是我数据文件中的第三列? [英] Line plot in GnuPlot where line color is a third column in my data file?

查看:27
本文介绍了GnuPlot 中的线条图,其中线条颜色是我数据文件中的第三列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个如下所示的数据文件:

I have a datafile that looks like this:

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".

where the first column is my X value, the second column is my Y value, and the third column is a color. I'd like for each line segment to be colored according to the third column. So the first two line segments would be "color 1", the next would be "color 2", the next would be "color 3", and the final two would be "color 1" again.

我试过了:

plot 'file.dat' using 1:2:3 with lines rgb variable;

但我的线是全黑的.

这在 gnuplot 中可行吗?

Is this possible in gnuplot?

谢谢,加布

推荐答案

以下对我有用(gnuplot 4.4)

This following works for me (gnuplot 4.4)

plot "./file.dat" u 1:2:3 with lines  palette

希望这会有所帮助.

当我运行您的代码时,gnuplot 无法通过rgb"部分.

When I ran your code gnuplot couldn't pass the "rgb" part.

有关使用变量标签的示例,请参阅类似问题:GNUPLOT:数据取决于点大小的点图

For an example of using the variable tag see the similar question: GNUPLOT: dot plot with data depending dot size

在这里找到有用的例子:http://gnuplot.sourceforge.net/demo/pointsize.html

with the useful examples found here: http://gnuplot.sourceforge.net/demo/pointsize.html

一切顺利

汤姆

这篇关于GnuPlot 中的线条图,其中线条颜色是我数据文件中的第三列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆