Interchanged x and y coordinates in the legend images of horizontal bars
Brought to you by:
cfeuersaenger,
ludewich
There is a problem with the xbar legend image, see http://tex.stackexchange.com/q/284688/43317. May be the x and y coordinates in the legend image code of the xbar legend are interchanged?
\documentclass{article} \usepackage{pgfplots} %\pgfplotsset{ %/pgfplots/xbar legend/.style={ %/pgfplots/legend image code/.code={% %\draw[##1,/tikz/.cd,bar width=3pt,yshift=-0.2em,bar shift=0pt] %plot coordinates {(0.8em,0cm)(0.6em,2*\pgfplotbarwidth)};}% <- changed %}} \begin{document} \begin{tikzpicture} \begin{axis}[xbar] \addplot coordinates { (5.1,1)(2.5,2)}; \legend{legend1} \end{axis} \end{tikzpicture} \end{document}
Thanks for the bug report! You are right, this is a bug.
The suggested solution resembles the very same solution that I added two weeks ago. It will become part of the next stable of pgfplots (will come before the end of January 2016).