von esdd » Mi 18. Jul 2018, 13:12
Vaschan hat geschrieben:
Wäre es auch möglich statt 1,2,3,4,5.. I, II, III, I, II, III zu schreiben auf der Achse? Bzw wenn das nicht möglich ist die werte einfach auszublenden? für mich ist die Unterscheidung in Fall 1 und Fall 2 wichtiger als die oberen Ticks.
Beispielsweise:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}% aktuell wäre 1.16
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=0.9\textwidth,
height=0.42\textheight,
xlabel={},
ylabel={Prozent},
ymajorgrids,
xmin=-0.5, xmax=5.5,
ymin=50, ymax=150,
xtick={0,1,...,100},% <- eingefügt
xticklabel={\pgfmathparse{int(mod(\tick,3)+1)}\romannumeral\pgfmathresult},% <- eingefügt
minor x tick num=1,
major x tick style={draw=none},
minor x tick style={/pgfplots/minor tick length=1.5\baselineskip},
xtick pos=lower,
xtick align=outside,
xminorgrids,
extra x ticks={1,4},
extra x tick labels={Fall 1, Fall 2},
extra x tick style={ticklabel style={yshift=-2\baselineskip}},
]
\addplot[green, only marks,mark=diamond*] coordinates {(0,80) (1,70) (1,60)};
\addplot[red, only marks,mark=star] coordinates {(2,80) (3,70) (1,100)};
\pgfplotsinvokeforeach{0,...,2}{\coordinate(c#1) at ({-.5+#1*3},0|-current axis.south);}
\end{axis}
\foreach \i in {0,...,2}\draw[help lines](c\i)--+(0,-4*\baselineskip);
\end{tikzpicture}
\end{document}
Vaschan hat geschrieben:
extra x tick style={rotate=45,anchor=north east, text width=5cm,align=left},
Dieser Befehl funktioniert leider auch nicht so wie ich mir das vorstelle
Schau Dir doch an, wie ich die zusätzliche Beschriftung der x-Achse nach unten verschoben habe. Und damit Du besser beurteilen kannst, ob text width=5cm,align=left sinnvoll ist, ergänze vorübergehend ein draw.
extra x tick style={ticklabel style={anchor=north east,rotate=45, text width=5cm,align=left,draw}}
[quote="Vaschan"]
Wäre es auch möglich statt 1,2,3,4,5.. I, II, III, I, II, III zu schreiben auf der Achse? Bzw wenn das nicht möglich ist die werte einfach auszublenden? für mich ist die Unterscheidung in Fall 1 und Fall 2 wichtiger als die oberen Ticks.
[/quote]
Beispielsweise:
[code]
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}% aktuell wäre 1.16
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=0.9\textwidth,
height=0.42\textheight,
xlabel={},
ylabel={Prozent},
ymajorgrids,
xmin=-0.5, xmax=5.5,
ymin=50, ymax=150,
xtick={0,1,...,100},% <- eingefügt
xticklabel={\pgfmathparse{int(mod(\tick,3)+1)}\romannumeral\pgfmathresult},% <- eingefügt
minor x tick num=1,
major x tick style={draw=none},
minor x tick style={/pgfplots/minor tick length=1.5\baselineskip},
xtick pos=lower,
xtick align=outside,
xminorgrids,
extra x ticks={1,4},
extra x tick labels={Fall 1, Fall 2},
extra x tick style={ticklabel style={yshift=-2\baselineskip}},
]
\addplot[green, only marks,mark=diamond*] coordinates {(0,80) (1,70) (1,60)};
\addplot[red, only marks,mark=star] coordinates {(2,80) (3,70) (1,100)};
\pgfplotsinvokeforeach{0,...,2}{\coordinate(c#1) at ({-.5+#1*3},0|-current axis.south);}
\end{axis}
\foreach \i in {0,...,2}\draw[help lines](c\i)--+(0,-4*\baselineskip);
\end{tikzpicture}
\end{document}
[/code]
[quote="Vaschan"]
[code]
extra x tick style={rotate=45,anchor=north east, text width=5cm,align=left},
[/code]
Dieser Befehl funktioniert leider auch nicht so wie ich mir das vorstelle[/quote]
Schau Dir doch an, wie ich die zusätzliche Beschriftung der x-Achse nach unten verschoben habe. Und damit Du besser beurteilen kannst, ob [tt]text width=5cm,align=left[/tt] sinnvoll ist, ergänze vorübergehend ein [tt]draw[/tt].
[code]
extra x tick style={ticklabel style={anchor=north east,rotate=45, text width=5cm,align=left,draw}}
[/code]