4

I am trying to create multiple columnstacked histograms in gnuplot using the newhistogram command. The data share the same structure so I want the boxes to share the same key like in this question, but with a pattern fillstyle (not only color).

My script looks like this:

set style data histogram
set style histogram columnstacked
set style fill pattern
set boxwidth 0.75
set xtics ("fff" 0, "ggg" 1, "hhh" 3, "iii" 4)
set grid y
set border 3 # remove top and right plot-border

set key outside title 'key' width -30

plot \
newhistogram "data A" fs pattern 2 lt 1, \
"plot_test_data.out" u 2, '' u 3, \
newhistogram "data B" fs pattern 2 lt 1, \
"plot_test_data_2.out" u 2:key(1), '' u 3

which produces the following output:

columnstacked histograms

Could anybody explain why the key doesn't show the correct pattern? (I tried adding fs pattern in each using directive and removing the linetype, but nothing bears the desired output).

I am using

G N U P L O T Version 4.6 patchlevel 3
last modified 2013-04-12 Build System: Linux x86_64

with 2 test data sets

plot_test_data.out:

0 1 3 2 2
1 1 6 4 4 
2 2 5 4 5
3 1 1 3 4
4 1 2 4 5

plot_test_data_2.out:

0 1 4 3 1 
1 3 6 4 2 
2 2 5 6 4
3 2 5 5 3
4 1 3 4 2

thank you!

Community
  • 1
  • 1
kingusiu
  • 316
  • 2
  • 15

0 Answers0