von esdd » Do 2. Mär 2017, 13:45
Wenn Du bei der axis Umgebung die Option
ergänzt, dann kannst Du beispielsweise das folgende verwenden:
\node[anchor=east] at ({axis cs:14,29}-|current axis.west) {$U_{\mathrm{SOLL}}$};
Ohne die oben genannte Option kannst Du an der gewünschten Stelle eine Koordinate definieren und den Node an dieser Koordinate außerhalb der axis, aber innerhalb der tikzpicture Umgebung einfügen:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}% lädt auch tikz
\pgfplotsset{compat=newest}
\usepgfplotslibrary{units}
\begin{document}
\begin{figure}\centering
\begin{tikzpicture}
\pgfplotsset{
legend cell align = left,
legend pos = north east,
symbolic x coords={14,18,21,25},
xtick=data
}
\begin{axis}[
ymajorgrids,
no markers,
enlargelimits=false,
axis on top,
ybar=4pt,
width=\linewidth,
height=9.5cm,
axis lines*=left,
xlabel={Stickout~\lbrack mm\rbrack},
ylabel=$U \lbrack \mathrm{V} \rbrack$,
axis y discontinuity=crunch,
%xtick={14,18,21,25},
ytickmin=30,
ytickmax=38,
ymin=28,
ymax=38,
bar width=18pt,
enlarge x limits=0.2,
nodes near coords,
every node near coord/.append style=
{
font=\normalsize,
fill=white,
anchor=south
},
legend pos = north west
]
\begin{scope} % Hilfslinie
\draw[thick,dashed,black] ({rel axis cs:1,0}|-{axis cs:14,29}) -- ({rel axis cs:0,0}|-{axis cs:25,29}) node[anchor=east,left] at (axis cs:14,29) {$U_{\mathrm{SOLL}}$};
\end{scope}
\coordinate (y1) at ({axis cs:14,29}-|current axis.west);
\addplot[style={fill=blue!50!cyan},error bars/.cd, y dir=both, y explicit]
coordinates {
(14,32.3) += (0,1.1) -= (0,1.1)
(18,33.4) += (0,1.1) -= (0,1.1)
(21,34.3) += (0,1.1) -= (0,1.1)
(25,35.0) += (0,1.1) -= (0,1.1)};\addlegendentry{Smart Connector}
\addplot[style={fill=red!85!magenta},error bars/.cd, y dir=both, y explicit]
coordinates {
(14,34.7) += (0,0.7) -= (0,0.7)
(18,35.7) += (0,0.6) -= (0,0.6)
(21,36.7) += (0,0.6) -= (0,0.6)
(25,37.4) += (0,0.6) -= (0,0.6)};\addlegendentry{HKS-WeldAnalyst}
\addplot[style={fill=green!50!olive},error bars/.cd, y dir=both, y explicit]
coordinates {
(14,30.8) += (0,0.7) -= (0,0.7)
(18,32.1) += (0,1.5) -= (0,1.5)
(21,33.2) += (0,2.4) -= (0,2.4)
(25,34.1) += (0,2.4) -= (0,2.4)};\addlegendentry{Fronius TPS 5000}
\end{axis}
\node[anchor=east] at (y1) {$U_{\mathrm{SOLL}}$};
\end{tikzpicture}
\end{figure}
\end{document}
Mit ein paar weiteren Anpassungen könnte man auch die Option extra y ticks dafür nutzen.
Wenn Du bei der [tt]axis[/tt] Umgebung die Option [code]clip=false[/code] ergänzt, dann kannst Du beispielsweise das folgende verwenden:
[code]\node[anchor=east] at ({axis cs:14,29}-|current axis.west) {$U_{\mathrm{SOLL}}$};[/code]
Ohne die oben genannte Option kannst Du an der gewünschten Stelle eine Koordinate definieren und den Node an dieser Koordinate außerhalb der [tt]axis[/tt], aber innerhalb der [tt]tikzpicture[/tt] Umgebung einfügen:
[code]\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}% lädt auch tikz
\pgfplotsset{compat=newest}
\usepgfplotslibrary{units}
\begin{document}
\begin{figure}\centering
\begin{tikzpicture}
\pgfplotsset{
legend cell align = left,
legend pos = north east,
symbolic x coords={14,18,21,25},
xtick=data
}
\begin{axis}[
ymajorgrids,
no markers,
enlargelimits=false,
axis on top,
ybar=4pt,
width=\linewidth,
height=9.5cm,
axis lines*=left,
xlabel={Stickout~\lbrack mm\rbrack},
ylabel=$U \lbrack \mathrm{V} \rbrack$,
axis y discontinuity=crunch,
%xtick={14,18,21,25},
ytickmin=30,
ytickmax=38,
ymin=28,
ymax=38,
bar width=18pt,
enlarge x limits=0.2,
nodes near coords,
every node near coord/.append style=
{
font=\normalsize,
fill=white,
anchor=south
},
legend pos = north west
]
\begin{scope} % Hilfslinie
\draw[thick,dashed,black] ({rel axis cs:1,0}|-{axis cs:14,29}) -- ({rel axis cs:0,0}|-{axis cs:25,29}) node[anchor=east,left] at (axis cs:14,29) {$U_{\mathrm{SOLL}}$};
\end{scope}
\coordinate (y1) at ({axis cs:14,29}-|current axis.west);
\addplot[style={fill=blue!50!cyan},error bars/.cd, y dir=both, y explicit]
coordinates {
(14,32.3) += (0,1.1) -= (0,1.1)
(18,33.4) += (0,1.1) -= (0,1.1)
(21,34.3) += (0,1.1) -= (0,1.1)
(25,35.0) += (0,1.1) -= (0,1.1)};\addlegendentry{Smart Connector}
\addplot[style={fill=red!85!magenta},error bars/.cd, y dir=both, y explicit]
coordinates {
(14,34.7) += (0,0.7) -= (0,0.7)
(18,35.7) += (0,0.6) -= (0,0.6)
(21,36.7) += (0,0.6) -= (0,0.6)
(25,37.4) += (0,0.6) -= (0,0.6)};\addlegendentry{HKS-WeldAnalyst}
\addplot[style={fill=green!50!olive},error bars/.cd, y dir=both, y explicit]
coordinates {
(14,30.8) += (0,0.7) -= (0,0.7)
(18,32.1) += (0,1.5) -= (0,1.5)
(21,33.2) += (0,2.4) -= (0,2.4)
(25,34.1) += (0,2.4) -= (0,2.4)};\addlegendentry{Fronius TPS 5000}
\end{axis}
\node[anchor=east] at (y1) {$U_{\mathrm{SOLL}}$};
\end{tikzpicture}
\end{figure}
\end{document} [/code]
Mit ein paar weiteren Anpassungen könnte man auch die Option [tt]extra y ticks[/tt] dafür nutzen.