I try to format a ybar diagram nicely.
Minimum Working Example (MWE):
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
ybar = 1.5mm,
ymin = 0,
ymax = 300,
% set layers = true,
% axis on top = true,
symbolic x coords = {Blub, Blab, Blop},
ymajorgrids = true,
nodes near coords,
nodes near coords align = {vertical},
nodes near coords style = {text=black},
every node near coord/.append style={rotate=90, anchor=west},
]
\addplot[fill=red, draw=red] coordinates {(Blab,180) (Blop,180) (Blub,180)};%
\end{axis}
\end{tikzpicture}
\end{document}
Screenshot of the result:
Screenshot of the issue:
Description of the issue:
As you can see, the ybars are positioned in a visibility layer above the abscisse, therefore the abscisse is partly hidden by ybars. Well, I could easily activate set layers = true as well as axis on top = true, but in this case also the grid will be moved to the foreground layer while then hiding the node label texts. However, the node label texts should remain in the foreground above the grid lines (like seen here):
Therefore it is not possible to just activate the upper commands.
Is there an option available to only put abscisse (x-axis) and ordinate (y-axis) to the foreground layer of visibility while keeping the grids in the background?
The user marmot has posted an approach on how to keep the node text labels in the foreground, even when setting set layers = true and axis on top = true. Would it be possible to do something similar for abscisse and ordinate only while keeping grid in background?



Package pgfkeys Error: I do not know the key '/tikz/nodes near coords style', to which you passed 'text=black', and I am going to ignore it. Perhaps you misspelled it. [ \end{axis}]– Sebastiano Apr 07 '19 at 08:27x-axisor the plot actually. I just want to put the abscisse into a visibility layer above the plot, so the plot can not hide thex-axisanymore. :-) – Dave Apr 07 '19 at 09:20