我在下面代码中使用了 scale 选项,期望使在“图1”和“图2”对齐的前提下,尽量使图和表一样大。不过若采取这种方式,那么遇到这种情况将不断调试 scale 的值,这显然不优雅。希望能得到一个通用的解决办法。
\documentclass[UTF8]{ctexart}
\usepackage{tikz,tabularray,amsmath,showframe}
\begin{document}
\begin{center}
\zihao{-6}
\begin{minipage}{.5\linewidth}
\centering
\begin{tblr}{baseline=c,columns={c,m},hlines,vlines}
级数 & 名称 & {风速大小\\(单位: $\mathrm{m/s}$)}\\
2 & 轻风 & $1.6\,\text{{}\~{}}\,3.3$ \\
3 & 微风 & $3.4\,\text{{}\~{}}\,5.4$ \\
4 & 和风 & $5.5\,\text{{}\~{}}\,7.9$ \\
5 & 劲风 & $8.0\,\text{{}\~{}}\,10.7$ \\
\end{tblr}\\[1ex]图1
\end{minipage}%
\begin{minipage}{.5\linewidth}
\centering
\begin{tikzpicture}[baseline={(current bounding box.center)},scale=.6875]
\draw[dash pattern=on 2pt off 2pt,gray]
(0,0) grid (3,3);
\draw[-stealth] (-.5,0) -- (3.5,0);
\draw[-stealth] (0,-.5) -- (0,3.5);
\draw[-stealth] (3,3) -- (0,2);
\draw[-stealth] (2,0) -- (3,3);
\foreach \x in {1,2,3} {
\node at (\x,0) [below] {$\x$};
\node at (0,\x) [left] {$\x$};}
\node at (0,0) [below left] {$O$};
\node at (3.5,0) [below] {$x$\vphantom{123}};
\node at (0,3.5) [left] {$y$};
\node at (1,3) [below] {视风风速};
\node at (2.5,0) [above] {船速};
\end{tikzpicture}\\[1ex]图2
\end{minipage}
\end{center}
\end{document}