Assumed we have this Minimum Working Example (MWE):
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
ybar,
xtick = data,
ymin = 0,
symbolic x coords = {Bar 1, Bar 2, Bar 3},
nodes near coords,
]
\addplot coordinates {(Bar 1, 50) (Bar 2, 0) (Bar 3, 50)};%
\end{axis}
\end{tikzpicture}
\end{document}
Screenshot of the result:
Description of the issue:
As you can see, there is some ugly "0" at the middle ybar
. How can I avoid/hide nodes near coords
if their corresponding value is 0
, so the displayed number should be invisible?
Bar 2
, so I want to hide the0
. In reality this is a multi coord diagram, so don't wonder about my silly question please. :-) – Dave Jun 21 '19 at 18:33ybars
, separated into fivesymbolic x coords
while coords 1 - 3 have three ybars each, coords 4 and 5 only have one. – Dave Jun 21 '19 at 18:37