我使用 tikz 包绘制了两个图表。
但是,存在有关“\tikz\width”和“\tikz\height”的错误。
如何修复这些错误?
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{figure}[t]
\centering
\begin{minipage}[t]{.47\textwidth}
\centering
\begin{tikzpicture}
\begin{axis}[
width = \linewidth,
height = \linewidth,
compat=newest,
ylabel = Y,
xlabel = X,
ymode = log,
xmajorgrids = true,
ymajorgrids = true,
xmin = 100, xmax = 350,
ymin = 1, ymax = 7,
xtick = {100, 150, 200, 250, 300, 350},
ytick = {1, 2, 3, 4, 5, 6, 7},
yticklabels = {$1$, $2$, $3$, $4$, $5$, $6$, $7$},
every tick/.style={small}
]
\addplot[
scatter/classes={1={mark=*},2={mark=x}},
scatter = true,
scatter src = explicit symbolic,
only marks,
scatter,
nodes near coords* = {\scriptsize\Label},
visualization depends on = {value \thisrow{name} \as \Label},
] table [ x = {X}, y = {Y}, meta = class] {
Y X class name
1.216 133.9 1 A
6.176 217.8 1 B
2.048 329.6 2 C
1.536 278.2 2 D
1.408 316.9 2 E
1.256 341.2 1 F
1.721 167.8 1 G
};
\end{axis}
\end{tikzpicture}
\label{fig:1}
\end{minipage}
\hfill
\begin{minipage}[t]{.47\textwidth}
\begin{tikzpicture}
\begin{axis}[
width = \linewidth,
height = \linewidth,
compat=newest,
ylabel = Y,
xlabel = X,
ymode = log,
xmajorgrids = true,
ymajorgrids = true,
xmin = 200, xmax = 1200,
ymin = 2, ymax = 17,
xtick = {200, 400, 600, 800, 1000, 1200},
ytick = {2, 4, 6, 8, 10, 12, 14, 16},
yticklabels = {$2$, $4$, $6$, $8$, $10$, $12$, $14$, $16$},
every tick/.style={small}
]
\addplot[
scatter/classes={1={mark=*},2={mark=x}},
scatter = true,
scatter src = explicit symbolic,
only marks,
scatter,
nodes near coords* = {\scriptsize\Label},
visualization depends on = {value \thisrow{name} \as \Label},
] table [ x = {X}, y = {Y}, meta = class] {
Y X class name
2.400 231.5 1 A
16.448 737.3 1 B
4.032 673.5 2 C
3.136 656.0 2 D
2.784 934.8 2 E
2.480 1101.6 2 F
3.281 402.5 1 G
};
\end{axis}
\end{tikzpicture}
\label{fig:2}
\end{minipage}
\caption{CAPTION}
\label{fig:SOME}
\end{figure}
\end{document}