【问题标题】:I want to fill my gnuplot plots with variable colors using filledcurves我想用填充曲线填充我的 gnuplot 图
【发布时间】:2016-01-29 23:25:19
【问题描述】:

这应该不是什么大问题,但看起来确实如此。我有一个包含 3 列的文件 - x 数据、y 数据和十六进制颜色数据。

plot "data" using 1:2:3 with filledcurves x1 linecolor variable

如果我使用此代码,我的情节 上方 行 - 边框 - 确实是这样着色的(使用十六进制颜色数据)。但是,我想确保 填充颜色 也与线条颜色相同。现在它是灰色的。

参考 gnuplot 帮助,我在 fillstyle 上读到了这篇文章:

solid 选项会导致填充纯色,如果终端 支持这一点。 density 参数指定的强度 填色。 density 为 0.0,框为空,density 为 1.0, 内部区域与当前线型颜色相同。

我将其解释如下。如果我使用:

set style solid 1

它将使我的填充变得坚实,并复制当前线型的颜色。此线型当前设置了线色“变量” - 所以它应该只复制该值,对吗?但是,它没有。

这里要回答的基本问题是:

如何使filledcurves 样式的特定部分具有不同的填充颜色?

【问题讨论】:

标签: gnuplot


【解决方案1】:

此功能尚未在稳定版gnuplot (2016-01-30) 中发布。

变量填充的类似问答如下所示: Gnuplot filledcurves with palette

但是,另一种解决方案adapted from the feature-request

stats infile using 2
N = STATS_blocks
set cbrange [0:N]
plot for [poly=0:N-1] "data" index poly using 1:2 with filledcurves x1 fillcolor palette cb poly lw 2

注意,要使用此解决方案,您应该将数据分成块(文件中的2 blank lines between 块)

幸运的是,功能请求昨天(2016-01-29)已解决,因此您可以尝试从CVS下载最新代码,编译gnuplot,然后运行smth。喜欢

plot 'data' using 1:2:(column(-2)) with filledcurves closed fillcolor palette z

to color data with the value of data index.

【讨论】:

  • 伟大的研究!谢谢!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多