1

how can I change the fill colour for columnstacked histogram? My data looks like:

xticlabel_1 xticlabel_2 xticlabel_3
10 20 15

and my script:

set datafile separator "\t"
set term postscript colour solid
set size 1,0.5
set output 'duplication_stats.eps'
set style data histograms
set style histogram columnstacked
set boxwidth 0.5
set style fill solid border -1
set tics scale 0.0
set ytics
set xtics rotate by -20
#
plot 'duplication_stats' using 2 ti col lc rgb "grey"
  1. If I remove "columnstacked", then xtic labels disappear, but the plotted histogram bar is grey, as expected.

  2. If "columnstacked" is used, then the histogram bar is red, and 'lc rgb grey' is simply ignored.

And I want to have both - (1) xtic labels from first row and (2) different colours for histogram bars plotted from different columns.

Do you know how to achieve it?

Thank you very much in advance.

4

1 回答 1

2

对于columnstacked直方图,一行的所有条目都用相同的颜色绘制,下一行将使用另一种颜色。原则上,您可以实现newhistogram每次设置另一种颜色at <xpos>所需的内容,也可以使用newhistogram.

set term postscript colour solid
set size 1,0.5
set output 'duplication_stats.eps'
set style data histograms
set style histogram columnstacked
set boxwidth 0.5
set style fill solid 1.00 noborder
set tics scale 0.0
set ytics
set xtics rotate by -20
#
plot 'duplication_stats' u 1 lt 1 title columnhead,\
     newhistogram lt 2 at 1, '' u 2 ti col,\
     newhistogram lt 3 at 2, '' u 3 ti col

这给了我:

在此处输入图像描述

请注意,这仅在 gnuplot 4.6 补丁级别 1 之后才有效,而 4.6.0 则不起作用。

于 2013-08-23T12:33:57.847 回答