I want to create a horizontal bar graph using symbolic y labels. However I:
- want to have the bars next to each other (i.e., no space between)
- I want some margin below and above the first and last bar for readability
\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xbar,
axis y line=center,
axis x line=center,
bar width=4pt,
bar shift=0pt,
y=4pt,
nodes near coords, nodes near coords align={horizontal},
symbolic y coords={A,B,C,D,E,F},
]
\addplot[fill=blue] coordinates { (-58,A) (-45,B) (-43,C) };
\addplot[fill=red] coordinates {
(19,D)
(35,E)
(65,F)
};
\end{axis}
\end{tikzpicture}
\end{document}
Currently it looks like this and any height specifications are changed into width specifications.

