title: Group bar chart graph with two different y-axis scales in gnuplot?
body: <p>Good day,</p>
  
  <p>I need to create a group bar chart graph with different scales.</p>
  
  <p>Consider following data example:
  <pre><code>Metric A B
  Group1 10 1500
  Group2 20 4000
  </pre></code></p>
  
  <p>I am using this <a href="https://stackoverflow.com/questions/27758057/histogram-using-gnuplot-with-multiple-y-axes">answer</a> and this code:
  <pre><code>reset
  set style histogram cluster gap 1
  set style data histograms
  set style fill solid 1.00 border
  set yrange [0:<em>]
  set ytics nomirror
  set y2range [0:</em>]
  set y2tics</p>
  
  <p>set key right autotitle columnheader
  plot 'file.dat' u 2 every ::::0, '' u 3:xtic(1) every ::::0,\
       newhistogram lt 1 at 1,\
       'file.dat' u 2 every ::1::1 axes x1y1, '' u 3:xtic(1) every ::1::1 axes x1y2</pre></code></p>
  
  <p>The code above creates this plot:</p>
  
  <p><a href="https://i.stack.imgur.com/Ho4pU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ho4pU.png" alt="enter image description here"></a></p>
  
  <p>However, what I need is:</p>
  
  <ol>
  <li>Left Y scale to be [0:20]</li>
  <li>All numbers from A to be plotted according to left Y scale</li>
  <li>All numbers from B to be plotted according to right Y scale</li>
  <li>If possible, to put labels on both left and right Y scale.</li>
  <li>If possible, to have only one pair of A and B in the legend.</li>
  </ol>
  
  <p>This way, the Violet color Bars will be much higher, and dependent only on column A number range.</p>
  
  <p>Thank you very much!</p>