![Zwei Bildunterschriften unter vier Abbildungen, eingewickelt in Miniseiten](https://rvso.com/image/328481/Zwei%20Bildunterschriften%20unter%20vier%20Abbildungen%2C%20eingewickelt%20in%20Miniseiten.png)
Ich habe vier Abbildungen und hätte gerne zwei Bildunterschriften zentriert unter jeder Gruppe von zwei Abbildungen, anstatt eine Bildunterschrift unter allen vier Abbildungen (siehe Abbildung unten). Wenn ich jedoch versuche, nach den ersten beiden Miniseiten eine Bildunterschrift einzufügen, gerät die gesamte Abbildungsausrichtung durcheinander. Wie kann das richtig gemacht werden?
\begin{figure}
\centering
% + +
\begin{minipage}{.2\textwidth}
\begin{tikzpicture}[transform canvas={scale=0.5}]
\begin{axis}[
axis lines=middle,
grid = major,
xmin=-2, xmax=2,
ymin=-2, ymax=2,
xlabel=$x_1$,
ylabel=$x_2$,
xtick={-2,-1,0,...,2},
ytick={-2,-1,0,...,2}]
\addplot [thin, samples=100] {0};
\addplot [only marks, mark = +, color = red] table {
-1 0
0 1
};
\draw [-latex, red, thick] (0,0) -- (-1,0);
\end{axis}
\end{tikzpicture}
\end{minipage}\hfill
\begin{minipage}{.2\textwidth}
\begin{tikzpicture}[transform canvas={scale=0.5}]
\begin{axis}[
axis lines=middle,
grid = major,
xmin=-2, xmax=2,
ymin=-2, ymax=2,
xlabel=$x_1$,
ylabel=$x_2$,
xtick={-2,-1,0,...,2},
ytick={-2,-1,0,...,2}]
\addplot [thin, samples=100] {x};
\addplot [only marks, mark = +, color = red] table {
-1 0
0 1
};
\draw [-latex, red, thick] (0,0) -- (-1,1);
\end{axis}
\end{tikzpicture}
\end{minipage}\hfill\quad\quad
% + -
\begin{minipage}{.2\textwidth}
\begin{tikzpicture}[transform canvas={scale=0.5}]
\begin{axis}[
axis lines=middle,
grid = major,
xmin=-2, xmax=2,
ymin=-2, ymax=2,
xlabel=$x_1$,
ylabel=$x_2$,
xtick={-2,-1,0,...,2},
ytick={-2,-1,0,...,2}]
\addplot [thin, samples=100] {0};
\addplot [only marks, mark = +, color = red] table {
-1 0
};
\addplot [only marks, mark = -, color = blue] table {
0 1
};
\draw [-latex, red, thick] (0,0) -- (-1,0);
\end{axis}
\end{tikzpicture}
\end{minipage}\hfill
\begin{minipage}{.2\textwidth}
\begin{tikzpicture}[transform canvas={scale=0.5}]
\begin{axis}[
axis lines=middle,
grid = major,
xmin=-2, xmax=2,
ymin=-2, ymax=2,
xlabel=$x_1$,
ylabel=$x_2$,
xtick={-2,-1,0,...,2},
ytick={-2,-1,0,...,2}]
\addplot [thin, samples=100] {-x};
\addplot [only marks, mark = +, color = red] table {
-1 0
};
\addplot [only marks, mark = -, color = blue] table {
0 1
};
\draw [-latex, red, thick] (0,0) -- (-1,-1);
\end{axis}
\end{tikzpicture}
\end{minipage}
\caption{Caption}
\label{fig:my_label}
Antwort1
Ich nehme an, dass Du so etwas gerne hättest:
Um dieses Bild zu erhalten, habe ich Folgendes getan:
- Verwenden Sie nur zwei Miniseiten, jede für eine tabellarische Umgebung
- in tabellarischen Umgebungen platzieren Sie Ihre Bilder
- Ändern Sie Ihr Bild leicht – verkleinern Sie es und lassen Sie die Leinwandtransformation weg (das kann knifflig sein)
- Fügen Sie auf jeder Miniseite eine Überschrift ein
Der vollständige Code lautet:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage[margin=30mm]{geometry}
\begin{document}
\begin{figure}[h]
\begin{minipage}{.48\textwidth}
\begin{tabular}{cc}
\begin{tikzpicture}[scale=0.45]
\begin{axis}[
axis lines=middle,
grid = major,
xmin=-2, xmax=2,
ymin=-2, ymax=2,
xlabel=$x_1$,
ylabel=$x_2$,
xtick={-2,-1,0,...,2},
ytick={-2,-1,0,...,2}]
\addplot [thin, samples=100] {0};
\addplot [only marks, mark = +, color = red] table {
-1 0
0 1
};
\draw [-latex, red, thick] (0,0) -- (-1,0);
\end{axis}
\end{tikzpicture}
& \begin{tikzpicture}[scale=0.45]
\begin{axis}[
axis lines=middle,
grid = major,
xmin=-2, xmax=2,
ymin=-2, ymax=2,
xlabel=$x_1$,
ylabel=$x_2$,
xtick={-2,-1,0,...,2},
ytick={-2,-1,0,...,2}]
\addplot [thin, samples=100] {x};
\addplot [only marks, mark = +, color = red] table {
-1 0
0 1
};
\draw [-latex, red, thick] (0,0) -- (-1,1);
\end{axis}
\end{tikzpicture}
\end{tabular}
\caption{Caption A}
\label{fig:my_label-A}
\end{minipage}
\hfill
\begin{minipage}{.48\textwidth}\centering
\begin{tabular}{cc}
\begin{tikzpicture}[scale=0.45]
\begin{axis}[
axis lines=middle,
grid = major,
xmin=-2, xmax=2,
ymin=-2, ymax=2,
xlabel=$x_1$,
ylabel=$x_2$,
xtick={-2,-1,0,...,2},
ytick={-2,-1,0,...,2}]
\addplot [thin, samples=100] {0};
\addplot [only marks, mark = +, color = red] table {
-1 0
};
\addplot [only marks, mark = -, color = blue] table {
0 1
};
\draw [-latex, red, thick] (0,0) -- (-1,0);
\end{axis}
\end{tikzpicture}
&
\begin{tikzpicture}[scale=0.45]
\begin{axis}[
axis lines=middle,
grid = major,
xmin=-2, xmax=2,
ymin=-2, ymax=2,
xlabel=$x_1$,
ylabel=$x_2$,
xtick={-2,-1,0,...,2},
ytick={-2,-1,0,...,2}]
\addplot [thin, samples=100] {-x};
\addplot [only marks, mark = +, color = red] table {
-1 0
};
\addplot [only marks, mark = -, color = blue] table {
0 1
};
\draw [-latex, red, thick] (0,0) -- (-1,-1);
\end{axis}
\end{tikzpicture}
\end{tabular}
\caption{Caption B}
\label{fig:my_label}
\end{minipage}
\end{figure}
\end{document}