![미니페이지에 싸인 4개의 그림 아래에 2개의 캡션](https://rvso.com/image/328481/%EB%AF%B8%EB%8B%88%ED%8E%98%EC%9D%B4%EC%A7%80%EC%97%90%20%EC%8B%B8%EC%9D%B8%204%EA%B0%9C%EC%9D%98%20%EA%B7%B8%EB%A6%BC%20%EC%95%84%EB%9E%98%EC%97%90%202%EA%B0%9C%EC%9D%98%20%EC%BA%A1%EC%85%98.png)
네 개의 그림이 있는데 네 그림 모두 아래에 하나의 캡션이 아닌 두 그림의 각 그룹 아래 중앙에 두 개의 캡션을 두고 싶습니다(아래 이미지 참조). 그러나 처음 두 개의 미니페이지 뒤에 캡션을 삽입하려고 하면 모든 그림 정렬이 엉망이 됩니다. 어떻게 하면 이 일을 제대로 할 수 있습니까?
\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}
답변1
나는 당신이 다음과 같은 것을 갖고 싶어한다고 가정합니다.
이 사진을 얻기 위해 다음을 수행했습니다.
- 하나의 테이블 형식 환경에 각각 두 개의 미니 페이지만 사용합니다.
- 테이블 형식 환경에서는 이미지를 넣으십시오.
- 이미지를 약간 변경하여 이미지를 더 작게 만들고 캔버스 변환을 생략합니다(까다로울 수 있음)
- 각 미니 페이지에 캡션을 넣으세요.
전체 코드는 다음과 같습니다.
\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}