Gnuplot 新直方图中的不同颜色

Gnuplot different colors inside newhistogram

我正在绘制一个与此图(this page 上的最后一个)非常相似的直方图 rowstacked:

我想做的是为每个年份的箱子设置不同的颜色。这种颜色会从一个新直方图重复到另一个。我还没有找到一种方法来做到这一点。

我试图完成的数据示例是

here

感谢您的帮助。

那么你的实际问题是什么?使用 histograms 绘图应该可以正常工作。考虑以下数据文件

A -1 1 -0.5 0.5
B -2 2 -1   1
C -3 3 -1.5 1.5
D -4 4 -2   2
E -5 5 -2.5 2.5
F -4 4 -2   2
G -3 3 -1.5 1.5

你可以用它来绘制

set key tmargin horizontal
set style fill solid noborder
set style data histograms
set style histogram gap 1
plot 'data.dat' using 2:xtic(1) title "First",\
     '' using 4 title "Second",\
     newhistogram at 0,\
     '' using 3 title "Third",\
     '' using 5 title "Fourth"

结果是

在这里,我明确假设,在一列中您只有负值或只有正值。但一般情况下没有必要。所有进一步的微调都取决于您的实际数据文件格式和其他未知条件。