pgf-tikz / pgfplots

pgfplots - A TeX package to draw normal and/or logarithmic plots directly in TeX in two and three dimensions with a user-friendly interface and pgfplotstable - a TeX package to round and format numerical tables. Examples in manuals and/or on web site.
http://pgfplots.sourceforge.net/
195 stars 34 forks source link

Interchanged x and y coordinates in the legend images of horizontal bars #100

Closed pgf-tikz-bot closed 4 years ago

pgf-tikz-bot commented 8 years ago

Migrated from SourceForge https://sourceforge.net/p/pgfplots/bugs/100/ Author: esdd Timestamp: 2015-12-26 00:52:11.927000

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}
pgf-tikz-bot commented 8 years ago

Migrated from SourceForge https://sourceforge.net/p/pgfplots/bugs/100/#b4be Author: cfeuersaenger Timestamp: 2015-12-28 09:06:10.141000

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).

pgf-tikz-bot commented 8 years ago

Migrated from SourceForge https://sourceforge.net/p/pgfplots/bugs/100/#b4f0 Author: cfeuersaenger Timestamp: 2015-12-28 09:06:36.995000