title: Gnuplot: Multiple histograms with different keys
body: <p>I want to plot multiple rowstacked histograms on the same graph using gnuplot. A sample data file is the following:</p>
  
  <pre><code>App1 20 30 50
  App2 10 20 70
  </code></pre>
  
  <p>The script I use is this</p>
  
  <pre><code>set terminal jpeg medium
  set output "histo.jpeg"
  set boxwidth 0.75 absolute
  set style fill solid 1.00 border -1
  set style data histogram
  set style histogram rowstacked
  set xtics 1000 nomirror
  set ytics 100 nomirror
  set mxtics 2
  set mytics 2
  set ytics 10
  set yrange [0:120]
  set ylabel "Total time"
  set key below vertical
  
  plot 'data' using 2 t "Idle", '' using 3 t "User space", '' using 4 :xtic(1) t "Kernel space"
  </code></pre>
  
  <p>The result I am getting is this:<img src="https://i.stack.imgur.com/XeC4Y.jpg" alt="enter image description here"></p>
  
  <p>I would like to have separate keys below each histogram, since I want to display the amount of time each element is occupying which is different from one graph to the other. Also, possibly some elements appearing on one histogram will not appear on the other.</p>
  
  <p>My intention is to create a script that generates both the data file and the gnuplot script to automate this process.</p>
  
  <p>I have achieved the above using jgraph but the results are pretty poor in terms of appearance.</p>
  
  <p>Thanks a lot,</p>
  
  <p>Spap</p>