Gnuplot:多个堆叠的直方图,每组使用相同的键 [英] Gnuplot: Multiple Stacked Histograms, each group using the same key
问题描述
我正在尝试创建具有多个堆叠直方图的图,例如示例8 此处.但是根据我的数据,每个组都具有相同的四个类别.
I am trying to create a plot with multiple stacked histograms like example 8 here. But for my data, each group has the same four categories.
如何更改颜色和键,以使每个堆叠列的颜色变为红色,绿色,蓝色,粉红色?如此,钥匙在我要绘制的4件事中只有一个副本?
How do I change the colors and the key so that colors go Red, Green, Blue, Pink for every stacked column? And so the key only has one copy each of the 4 things I am plotting?
这是我用来绘制的线:
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
我的数据格式与我上面链接的示例相同:
My data is in the same format as the example I linked to above:
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
非常感谢您的帮助!
推荐答案
使用newhistogram后面的lt
指示符来指定gnuplot应该使用的第一种颜色.我写了一个小脚本,可以满足您的需求;)
use the lt
specifier behind newhistogram in order to specify the first color gnuplot should use. I wrote a little script that might does what you want;)
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
卧龙
Cherio
Woltan
这篇关于Gnuplot:多个堆叠的直方图,每组使用相同的键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!