2011-03-30 39 views
11

我正在尝试创建一个具有多个堆积直方图的图,如示例8 here。但对于我的数据,每个组都有相同的四个类别。Gnuplot:多个堆积直方图,每个组使用相同的密钥

enter image description here

如何改变颜色和键,使颜色变为红色,绿色,蓝色,粉红色,每叠列?那么关键只有一个我正在绘制的4件东西的副本?

这里是我使用绘制行:

plot newhistogram "1", 'addresses.dat' using 2:xtic(1) t 2, '' u 3 t 3, \ 
'' u 4 t 4, '' u 5 t 5, newhistogram "2", '' u 6 t 6, '' u 7 t 7, '' u 8 t 8,\ 
'' u 9 t 9 

我的数据是相同的格式为我联系到上面的例子:

Address PAL_Code BASH App Kernel PAL_Code BASH App Kernel 
FFT 1 1 2 2 1 1 3 4 
RADIX 1 2 3 4 1 2 4 5 
LU 1 3 4 5 1 3 5 6 

太感谢你了,如果你可以帮助!

回答

10

在newhistogram后面使用lt说明符以指定gnuplot应该使用的第一个颜色。我写了一个小脚本,可能你想要做什么;)

set style data histogram 
set style histogram rowstack gap 1 
set style fill solid border -1 
set boxwidth 0.9 
set key autotitle columnheader 
set key outside below center horizontal 
plot newhistogram "1" lt 1, 'addresses.dat' u 2:xtic(1), '' u 3, '' u 4, '' u 5,\ 
newhistogram "2" lt 1, 'addresses.dat' u 6:xtic(1) notitle, '' u 7 notitle, \ 
'' u 8 notitle, '' u 9 notitle 

希望帮助

Cherio
Woltan

+0

完美,非常感谢! – Philip 2011-03-30 19:04:43

+0

你知道我怎样才能完全分配新颜色? – user2373198 2016-10-18 13:11:38