I'm creating a stacked ybar
plot from some data, which causes the input coordinates to be not sorted. This causes a gap between some of the bars.
Is this a bug? Shouldn't the stacked ybar
plot know all the heights? If not, is there a simple way to fix this?
Surely i fix this in my program (i do some data processing beforehand), but i feel there should be an easy solution.
Here is a sample document:
\documentclass{scrartcl}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[
ybar stacked,
ymin = 0,
enlarge x limits
]
\addplot coordinates {
(1, 1)
(2, 2)
(3, 3)
};
\addplot coordinates {
(1, 1)
(3, 3) % 'wrong' order
(2, 2)
};
\end{axis}
\end{tikzpicture}
\end{document}
What i want is the following, which is produced by changing the 'wrongly' ordered lines in the second \addplot
command.