【问题标题】:How do I select a color for every point in Gnuplot data file?如何为 Gnuplot 数据文件中的每个点选择颜色?
【发布时间】:2011-03-15 16:48:54
【问题描述】:

我想绘制点,每个点都有 X、Y 和颜色。我如何在 Gnuplot 中做到这一点?

【问题讨论】:

    标签: plot gnuplot


    【解决方案1】:

    你可以试试这样的:

    Line plot in GnuPlot where line color is a third column in my data file?

    例如:

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

    file.dat 包含您的数据,第一列是 x 轴,第二列是 y 轴,第三列是颜色。

    【讨论】:

      【解决方案2】:

      您可以考虑查看 Pyxplot 绘图包 http://pyxplot.org.uk,它的语法与 gnuplot 非常相似(尽管经过大量清理),并且允许逐点指定点样式。例如,在 Pyxplot 中:

      plot "file.dat" using 1:2:3 with points color rgb($4,$5,$6)
      

      将从数据文件的第 4、5 和 6 列中获取每个点颜色的 RGB 分量。或者,

      plot "file.dat" using 1:2:3 with points color $4
      

      将读取数据文件第 4 列中的数字(称为 n),并使用调色板中的第 n 种颜色绘制每个点。如果 n 是非整数,比如 2.5,它会在 RGB 空间中为您提供介于颜色 2 和颜色 3 之间的颜色。

      【讨论】:

      • 语法与gnuplot有很大不同。在 gnuplot 中你不能做颜色 rgb(r,g,b)。
      猜你喜欢
      • 2019-05-10
      • 1970-01-01
      • 2020-08-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-05
      • 2019-07-06
      相关资源
      最近更新 更多