4 Bilder mit Subfigure, richtige Position und einzelne Legende
Hallo zusammen,
mit subfigure Befehl packe ich 4 Diagramme zusammen, wobei es gezielt ist, für alle 4 nur ein einzige Legende in einem externen Box unter 2 letzte Bilder,in der Mitte stehen zu lassen. Kann jemand mir damit helfen?
Vielen Dank im Voraus!
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{pgfplots}
\begin{document}
\begin{figure}[t]
\begin{subfigure}[t]{0.52\linewidth}
\centering
\begin{tikzpicture}[scale=0.7]
\begin{axis}[%
width=4.521in,
height=3.566in,
at={(0.758in,0.481in)},
scale only axis,
separate axis lines,
every outer x axis line/.append style={black},
every x tick label/.append style={font=\color{black}},
xmin=0,
xmax=7,
every outer y axis line/.append style={black},
every y tick label/.append style={font=\color{black}},
ymin=-1,
ymax=1,
axis background/.style={fill=white}
]
\addplot [color=blue,solid,forget plot]
table[row sep=crcr]{%
0 0\\
0.314159265358979 0.309016994374947\\
0.628318530717959 0.587785252292473\\
0.942477796076938 0.809016994374947\\
1.25663706143592 0.951056516295154\\
1.5707963267949 1\\
1.88495559215388 0.951056516295154\\
2.19911485751286 0.809016994374947\\
2.51327412287183 0.587785252292473\\
2.82743338823081 0.309016994374948\\
3.14159265358979 1.22464679914735e-16\\
3.45575191894877 -0.309016994374947\\
3.76991118430775 -0.587785252292473\\
4.08407044966673 -0.809016994374947\\
4.39822971502571 -0.951056516295154\\
4.71238898038469 -1\\
5.02654824574367 -0.951056516295154\\
5.34070751110265 -0.809016994374948\\
5.65486677646163 -0.587785252292473\\
5.96902604182061 -0.309016994374948\\
6.28318530717959 -2.44929359829471e-16\\
};
\end{axis}
\end{tikzpicture}%
\label{fig7:a}
\vspace{4ex}
\end{subfigure}%%
\begin{subfigure}[t]{1\linewidth}
\centering
\begin{tikzpicture}[scale=0.7]
\begin{axis}[%
width=4.521in,
height=3.566in,
at={(0.758in,0.481in)},
scale only axis,
separate axis lines,
every outer x axis line/.append style={black},
every x tick label/.append style={font=\color{black}},
xmin=0,
xmax=7,
every outer y axis line/.append style={black},
every y tick label/.append style={font=\color{black}},
ymin=-1,
ymax=1,
axis background/.style={fill=white}
]
\addplot [color=blue,solid,forget plot]
table[row sep=crcr]{%
0 1\\
0.314159265358979 0.951056516295154\\
0.628318530717959 0.809016994374947\\
0.942477796076938 0.587785252292473\\
1.25663706143592 0.309016994374947\\
1.5707963267949 6.12323399573677e-17\\
1.88495559215388 -0.309016994374947\\
2.19911485751286 -0.587785252292473\\
2.51327412287183 -0.809016994374947\\
2.82743338823081 -0.951056516295154\\
3.14159265358979 -1\\
3.45575191894877 -0.951056516295154\\
3.76991118430775 -0.809016994374947\\
4.08407044966673 -0.587785252292473\\
4.39822971502571 -0.309016994374948\\
4.71238898038469 -1.83697019872103e-16\\
5.02654824574367 0.309016994374947\\
5.34070751110265 0.587785252292473\\
5.65486677646163 0.809016994374947\\
5.96902604182061 0.951056516295154\\
6.28318530717959 1\\
};
\end{axis}
\end{tikzpicture}%
\label{fig7:b}
\vspace{4ex}
\end{subfigure}
\begin{subfigure}[t]{0.52\linewidth}
\centering
\begin{tikzpicture}[scale=0.7]
\begin{axis}[%
width=4.521in,
height=3.566in,
at={(0.758in,0.481in)},
scale only axis,
separate axis lines,
every outer x axis line/.append style={black},
every x tick label/.append style={font=\color{black}},
xmin=0,
xmax=7,
every outer y axis line/.append style={black},
every y tick label/.append style={font=\color{black}},
ymin=0,
ymax=300,
axis background/.style={fill=white}
]
\addplot [color=blue,solid,forget plot]
table[row sep=crcr]{%
0 0\\
0.314159265358979 0.319352539788101\\
0.628318530717959 0.670483998247118\\
0.942477796076938 1.08833562891639\\
1.25663706143592 1.61448804047485\\
1.5707963267949 2.30129890230729\\
1.88495559215388 3.21711308035704\\
2.19911485751286 4.45306366628894\\
2.51327412287183 6.13214067351471\\
2.82743338823081 8.42142983020873\\
3.14159265358979 11.5487393572577\\
3.45575191894877 15.8252692694943\\
3.76991118430775 21.6765790328456\\
4.08407044966673 29.6849351832573\\
4.39822971502571 40.6472529385026\\
4.71238898038469 55.6543975994175\\
5.02654824574367 76.1997370596106\\
5.34070751110265 104.327747534004\\
5.65486677646163 142.837460330862\\
5.96902604182061 195.560994749514\\
6.28318530717959 267.744894041016\\
};
\end{axis}
\end{tikzpicture}%
\label{fig7:c}
\end{subfigure}%%
\begin{subfigure}[t]{1\linewidth}
\centering
\begin{tikzpicture}[scale=0.7]
\begin{axis}[%
width=4.521in,
height=3.566in,
at={(0.758in,0.481in)},
scale only axis,
separate axis lines,
every outer x axis line/.append style={black},
every x tick label/.append style={font=\color{black}},
xmin=0,
xmax=7,
every outer y axis line/.append style={black},
every y tick label/.append style={font=\color{black}},
ymin=0,
ymax=300,
axis background/.style={fill=white},
legend style={at={(0.5,-0.15)},
anchor=north,legend columns=-1},
]
\addplot [color=blue,solid]
table[row sep=crcr]{%
0 1\\
0.314159265358979 1.04975523083675\\
0.628318530717959 1.20397208933822\\
0.942477796076938 1.47799676629174\\
1.25663706143592 1.89909758381088\\
1.5707963267949 2.50917847865806\\
1.88495559215388 3.36894888233769\\
2.19911485751286 4.56396494465314\\
2.51327412287183 6.21314326567266\\
2.82743338823081 8.48059434150281\\
3.14159265358979 11.5919532755215\\
3.45575191894877 15.8568328316849\\
3.76991118430775 21.6996331436087\\
4.08407044966673 29.7017739677984\\
4.39822971502571 40.6595520320454\\
4.71238898038469 55.6633808904387\\
5.02654824574367 76.2062984795469\\
5.34070751110265 104.332540012783\\
5.65486677646163 142.840960770259\\
5.96902604182061 195.563551479869\\
6.28318530717959 267.746761483748\\
};
\addlegendentry{case1};
\end{axis}
\end{tikzpicture}%
\label{fig7:d}
\end{subfigure}
\label{fig7}
\end{figure}
\end{document}