Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion] Automatically disable axis discontinuity with stacked bar plots #491

Open
itsstatsofficer opened this issue Sep 8, 2024 · 0 comments

Comments

@itsstatsofficer
Copy link

I suggest that xbar stacked also automatically sets xmin = 0 (and similarly for ybar stacked). For stacked bar plots, axis discontinuities do not make much sense, as it prevents us from comparing the impact of each element within the same stack.

Furthermore, axis discontinuities also messes up nodes near coords:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
        xbar stacked,
        nodes near coords,
        symbolic y coords = {Pizza,Ice Cream,Cookies},
        ytick = data,
    ]   
    \legend{Yes,No}
    \addplot coordinates {(71,Pizza) (70,Ice Cream) (63,Cookies)};
    \addplot coordinates {(15,Pizza) (16,Ice Cream) (23,Cookies)};
\end{axis}
\end{tikzpicture}

chart-1

With xmin = 0:
chart-2

If this change in behavior is undesirable, I would suggest at least mentioning this issue in the manual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant