I have two different pgfplots in two subfigures. I want to draw a line between the red circled data points and the blue ones. I added lines manually with LibreOffice Draw to show you what I mean.
My code is the follwing:
\begin{figure}[!htbp]
\centering
\subfigure[Ausgangszustand]{
\resizebox{0.45\textwidth}{!}{
\begin{tikzpicture}
\begin{axis}[
xlabel={Zeit [d]},
ylabel={Auslastung [\%]},
axis lines=left,
xmin=0,
xmax=7.5,
xtick={1,...,8},
ymin=0,
ymax=105,
thick,
grid=both
]
\addplot[smooth,thick] plot coordinates {
(0,35)
(1,60)
(2,20)
(3,95)
(4,45)
(5,30)
(6,60)
(7,55)
};
\addplot+[only marks,mark=o,mark options={scale=3},text mark as node=true] coordinates {
(3,95)
};
\addplot+[only marks,mark=o,mark options={scale=3},text mark as node=true,color=blue] coordinates {
(2,20)
};
\end{axis}
\end{tikzpicture}
}}
\qquad
\subfigure[Zielzustand]{
\resizebox{0.45\textwidth}{!}{
\begin{tikzpicture}
\begin{axis}[
xlabel={Zeit [d]},
ylabel={Auslastung [\%]},
axis lines=left,
xmin=0,
xmax=7.5,
xtick={1,...,8},
ymin=0,
ymax=105,
thick,
grid=both
]
\addplot[smooth,thick] plot coordinates {
(0,45)
(1,55)
(2,40)
(3,70)
(4,55)
(5,35)
(6,50)
(7,45)
};
\addplot+[only marks,mark=o,mark options={scale=3},text mark as node=true] coordinates {
(3,70)
};
\addplot+[only marks,mark=o,mark options={scale=3},text mark as node=true,color=blue] coordinates {
(2,40)
};
\end{axis}
\end{tikzpicture}
}}
\caption{Glättung von Lastspitzen}
\label{fig:Lastspitze}
\end{figure}
I want to draw the lines beginning and ending in the exact data points in the graphs. I did some googling but couldn't find an answer.