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

查看:156
本文介绍了在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。



我试过:

 使用1:2:3与线条rgb绘制'file.dat'变量; 

但是我的线条全黑。

这是可能的gnuplot?



谢谢,
Gabe

解决方案
  plot./file.datu 1:2: 3 with lines palette 

希望这有助于您。



当我运行代码时,gnuplot无法通过rgb部分。



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



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



全部最好



Tom

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

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.

I tried:

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

But my line was all black.

Is this possible in gnuplot?

Thanks, Gabe

解决方案

This following works for me (gnuplot 4.4)

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

Hope this helps.

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

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

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

All the best

Tom

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

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