Gnuplot: Multiple Stacked Histograms, each group using the same key

丶灬走出姿态 提交于 2019-12-20 09:19:53

问题


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.

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?

Here is the line I'm using to plot:

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

Thank you so much if you can help!


回答1:


use the ltspecifier 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

Hope that helps

Cherio
Woltan



来源:https://stackoverflow.com/questions/5483006/gnuplot-multiple-stacked-histograms-each-group-using-the-same-key

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!