我正在尝试创建一个我在其中绘制网格的图形。网格的每个“矩形”都应标有一个围绕它的圆圈的数字。我的目标是旋转这个数字和圆圈(或只是圆圈),使其位于矩形上。
因为我的网格矩形很少,所以我很乐意单独指定每个标签的旋转/位置。
下面是我的第一次尝试,灵感来自另一个 stackoverflow 帖子。它基于这样一个事实,即可以指定用于确定圆半径的坐标:例如,要在 xz 平面上绘制一个圆,我会写 circle[x={(1,0,0)}, y={(0,0,1)}, x radius=1,y radius=1];
。但就我而言,这似乎行不通,我不得不猜测/捏造矢量和/或半径,并留下一些不太正确的东西。
我错过了什么?这是当前代码的输出。
\tikzset{label/.style={draw=gray, fill=white, circle, minimum size=0pt, inner sep=2pt, outer sep=0pt, font=\large}}
\begin{tikzpicture}
\begin{axis}[
view = {-18}{30},
axis lines = center,
axis on top,
axis line style = {thick, black},
xmin=0, xmax=20,
ymin=0, ymax=20,
zmin=0, zmax=20,
ticks=none,
]
\addplot3[surf, red, opacity=0.7] coordinates {
(6.0, 6.0, 0.0) (6.0, 20.0, 0.0)
(6.0, 6.0, 20.0) (6.0, 20.0, 20.0)
};
\addplot3[mesh, surf, green, opacity=0.7] coordinates {
(6.0, 6.0, 0.0) (20.0, 6.0, 0.0)
(6.0, 6.0, 20.0) (20.0, 6.0, 20.0)
};
\addplot3[surf, yellow, opacity=0.7] coordinates {
(6.0, 6.0, 0.0) (6.0, 6.0, 20.0)
(0.0, 0.0, 0.0) (0.0, 0.0, 20.0)
};
% labels
\node[label] at (5,12,18) {$1$};
% \node[label] at (13,6,10) {$2$};
% \node[label] at (3,3,10) {$3$};
% attempt at rotated labels
\draw[thick, fill=white] (13,6,10) circle[x={(1,0,0)}, y={(0,0,16)}, x radius=.1,y radius=.1]; (1);
\node[] at (13,6,10) {$2$};
\draw[thick, fill=white] (3,3,10) circle[x={(1,1,0)}, y={(0,0,18)}, x radius=.1,y radius=.1]; (1);
\node[] at (3,3,10) {$3$};
\end{axis}
\end{tikzpicture}