title: Gnuplot rotate key
body: <p>I made a horizontal histogram by turning the diagram by 270° using the rotate package in LaTex. 
  It is no problem to adjust all the labels and tics, but I did not find a way to rotate the key. </p>
  
  <p><a href="https://i.stack.imgur.com/VwUZQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VwUZQ.png" alt="enter image description here"></a></p>
  
  <p>Here is my gnuplot code:</p>
  
  <pre><code>set terminal epslatex  size 16cm, 32cm
  set output "stackexchange.tex"
  set xrange [-1:8]
  set key
  set boxwidth 0.95
  set style data histograms
  set style histogram errorbars
  set style fill solid 0.8
  set style line 1 lt 1 lc rgb "#0080B0" lw 3
  set yrange[600:1100]
  unset ytics
  set y2tics rotate
  set y2label rotate "xyz / abc"
  set xtics nomirror rotate scale 0 
  plot 'stackexchange.dat' using 2:3:xticlabels(1) ls 1 title 'A', '' using 4:5 ls 1 fill pattern 6 title 'B'
  </code></pre>
  
  <p>That is how I implement it in LaTex:</p>
  
  <pre><code>\begin{figure}
          \begin{turn}{270}
          \resizebox{!}{0.9\textwidth}{\input{stackexchange}}
          \end{turn}
  \end{figure}
  </code></pre>
  
  <p>This is my datafile:</p>
  
  <pre><code>A     890.1  3.2  789.9 11.7 
  B    626.97      20.467      862.8 12.3
  C   923.9   5.89  963.8 3.7
  D    785.233     15.921     627   2.3
  E    903.167     7.94 880.9 1.9
  F    863.43      25.237     778.2 4.2
  G     909.6 5.370     941   13
  H     895.633     40.401    813   11.3
  </code></pre>