使用Gnuplot绘制灰度直方图

5

我刚接触gnuplot,想绘制一个任意长度数据集的三重直方图。这是我的代码,但是这一行 set palette gray 似乎没有效果 - 所有的颜色仍然是RGB的。我错过了什么吗?

set terminal pdf enhanced
set output 'out.pdf'

set palette gray

set style data histogram
set style histogram cluster gap 1

set style fill solid 1
set auto x
set yrange [0:*]
plot 'in.dat' using 2:xtic(1) title col, \
        '' using 3:xtic(1) title col, \
        '' using 4:xtic(1) title col
1个回答

5

set palette命令仅影响图像、pm3d表面和与linecolor palette一起使用的显式设置。

终端选项monochrome也不能帮助您,因为它将所有线条的颜色设置为黑色并使用不同的虚线样式。

您可以重新定义线型的颜色:

set linetype 1 lc rgb 'black'
set linetype 2 lc rgb '#555555'
set linetype 3 lc rgb '#999999'
plot 'in.dat' u 2:xtic(1) t col, '' u 3 t col, '' u 4 t col

请注意,reset 命令不会撤销此行类型更改。如果要撤销更改,必须重新启动 gnuplot。
或者,您也可以使用 set terminal pdf monochromeset style fill pattern 命令。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接