von Stamm- » Do 19. Feb 2015, 16:22
hansiglaser hat geschrieben:[…] In einem zweiten Bild hab ich "symbolic x coords", gibts da eine Möglichkeit, den "yshift"-Modulo-Trick auch zu verwenden? "\tick" wird da leider ein String, und "\coordindex" (wie für "x expr=\coordindex") kennt er dort gar nicht. […]
Wenn statt des Schlüssels »
symbolic x coords« die Kombination der Schlüssel »
xtick« und »
xticklabels« in der Umgebung »
axis« verwendet wird, hat die Versetzung der Marken eine Chance.
\documentclass[
11pt,
border=2pt
]{standalone}
\usepackage[T1]{fontenc}
\usepackage{selinput}
\SelectInputMappings{
adieresis={ä},
germandbls={ß}
}
\usepackage[ngerman]{babel}
\usepackage{pgfplots}
\pgfplotsset{
compat=1.12,
xlabel near ticks,
ylabel near ticks
}
\begin{document}
\begin{tikzpicture}[font=\footnotesize]
\begin{axis}[
width=13cm,
height=8cm,
enlargelimits=0.05,
xmin=1,
xmax=12,
xtick={1,2,...,12},
xticklabels={Januar,Februar,März,April,Mai,Juni,Juli,August,September,Oktober,November,Dezember},
x tick label style={yshift={-mod(\tick,2)*1em}},
ybar,
bar width=7pt,
/pgf/number format/1000 sep=\,
]
\addplot coordinates {
(1,5036)
(2,3386)
(3,4096)
(4,5106)
(5,7026)
(6,3806)
(7,4296)
(8,4356)
(9,4516)
(10,6526)
(11,4356)
(12,4516)
};
\addplot coordinates {
(1,3806)
(2,4296)
(3,4356)
(4,4516)
(5,6526)
(6,5036)
(7,3386)
(8,4096)
(9,5106)
(10,7026)
(11,4096)
(12,5106)};
\end{axis}
\end{tikzpicture}
\end{document}

[quote="hansiglaser"][…] In einem zweiten Bild hab ich "symbolic x coords", gibts da eine Möglichkeit, den "yshift"-Modulo-Trick auch zu verwenden? "\tick" wird da leider ein String, und "\coordindex" (wie für "x expr=\coordindex") kennt er dort gar nicht. […][/quote]
Wenn statt des Schlüssels »[tt][color=brown]symbolic x coords[/color][/tt]« die Kombination der Schlüssel »[tt][color=brown]xtick[/color][/tt]« und »[tt][color=brown]xticklabels[/color][/tt]« in der Umgebung »[tt][color=blue]axis[/color][/tt]« verwendet wird, hat die Versetzung der Marken eine Chance.
[code]\documentclass[
11pt,
border=2pt
]{standalone}
\usepackage[T1]{fontenc}
\usepackage{selinput}
\SelectInputMappings{
adieresis={ä},
germandbls={ß}
}
\usepackage[ngerman]{babel}
\usepackage{pgfplots}
\pgfplotsset{
compat=1.12,
xlabel near ticks,
ylabel near ticks
}
\begin{document}
\begin{tikzpicture}[font=\footnotesize]
\begin{axis}[
width=13cm,
height=8cm,
enlargelimits=0.05,
xmin=1,
xmax=12,
xtick={1,2,...,12},
xticklabels={Januar,Februar,März,April,Mai,Juni,Juli,August,September,Oktober,November,Dezember},
x tick label style={yshift={-mod(\tick,2)*1em}},
ybar,
bar width=7pt,
/pgf/number format/1000 sep=\,
]
\addplot coordinates {
(1,5036)
(2,3386)
(3,4096)
(4,5106)
(5,7026)
(6,3806)
(7,4296)
(8,4356)
(9,4516)
(10,6526)
(11,4356)
(12,4516)
};
\addplot coordinates {
(1,3806)
(2,4296)
(3,4356)
(4,4516)
(5,6526)
(6,5036)
(7,3386)
(8,4096)
(9,5106)
(10,7026)
(11,4096)
(12,5106)};
\end{axis}
\end{tikzpicture}
\end{document}[/code]
[img]http://i.imgur.com/EX4qjwk.png[/img]