von Bartman » Di 6. Dez 2016, 01:03
Mein Vorschlag:
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
% xmin=0,
ymin=0, ymax=450,
width=7cm, height=6cm,
% xtick=data,
xtick={1,...,5},
ylabel=Anzahl,
enlarge x limits=0.2,
enlarge y limits=false,
ybar,
% symbolic x coords={stimme sehr zu, stimme zu, unentschieden, stimme nicht zu,stimme gar nicht zu},
xticklabels = {stimme sehr zu, stimme zu, unentschieden, stimme nicht zu,stimme gar nicht zu},
x tick label style={rotate=45,anchor=east},
legend style={
at={(0.5,-0.6)},
anchor=north,
legend columns=-1
}
]
\addplot coordinates {(1,26) (2,160) (3,234) (4,283) (5, 319)};
\addplot[
red,
line legend,
sharp plot,
update limits=false
]
coordinates {(0,234)(6,234)};
\legend{Personen,Median};
\end{axis}
\end{tikzpicture}
\end{document}
Quelle: Abschnitt 4.5.4 Bar Plots in der Dokumentation von
pgfplots.
Mein Vorschlag:
[code]\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
% xmin=0,
ymin=0, ymax=450,
width=7cm, height=6cm,
% xtick=data,
xtick={1,...,5},
ylabel=Anzahl,
enlarge x limits=0.2,
enlarge y limits=false,
ybar,
% symbolic x coords={stimme sehr zu, stimme zu, unentschieden, stimme nicht zu,stimme gar nicht zu},
xticklabels = {stimme sehr zu, stimme zu, unentschieden, stimme nicht zu,stimme gar nicht zu},
x tick label style={rotate=45,anchor=east},
legend style={
at={(0.5,-0.6)},
anchor=north,
legend columns=-1
}
]
\addplot coordinates {(1,26) (2,160) (3,234) (4,283) (5, 319)};
\addplot[
red,
line legend,
sharp plot,
update limits=false
]
coordinates {(0,234)(6,234)};
\legend{Personen,Median};
\end{axis}
\end{tikzpicture}
\end{document}[/code]
Quelle: Abschnitt 4.5.4 Bar Plots in der Dokumentation von [p]pgfplots[/p].