【发布时间】:2013-08-21 21:49:51
【问题描述】:
与how to set label and line the same color in gnuplot 相关-但不完全相同...使用此代码:
set style line 1 linetype 1 linewidth 2 pointtype 3 linecolor rgb "aquamarine"
set style line 2 linetype 1 linewidth 2 pointtype 3 linecolor rgb "blue"
set style line 3 linetype 1 linewidth 2 pointtype 3 linecolor rgb "coral"
set xrange [0:3]
set yrange [0:3]
# function to get style index for coloring:
getCol(x) = (x==0)?1:((x==1)?2:3);
plot \
'-' using ($1+0.5):($2+0.5):(getCol($2)) with impulses \
lc variable notitle, \
"" using ($1+0.5):($2+0.5):(stringcolumn(2)):(getCol($2)) with labels \
textcolor variable point linestyle 1 pointtype 7 lc variable \
font ",6" offset character 1.0,character 1.0 notitle
0 0
1 1
1.5 1
2 2
e
0 0
1 1
1.5 1
2 2
e
...我得到这个输出:
看起来一切都可以为impulses 着色-但是对于labels,该方法似乎有效-但好像颜色是从不同的索引中读取的?!
那么,如何使用与脉冲线相同的函数使点和标签具有相同的可变颜色?这是在 gnuplot 4.6 补丁级别 1...
【问题讨论】:
-
这个问题在新发布的4.6 patchlevel 4中得到了修复。只需在绘图前添加
set style increment user行,你就会得到预期的结果(与my answer相同)。跨度>
标签: gnuplot