I'm trying to create a figure in which I plot a mesh. Each 'rectangle' of the mesh should be labelled with a number that has a circle around it. My goal is to rotate this number and circle (or just the circle) so that it lies on the rectangle.
As I have very few mesh rectangles, I am happy to specify the rotation/position of each label individually.
Below is my first attempt, inspired by another stackoverflow post. It's based on the fact that it's possible to specify coordinates that are used to determine the radius of the circle: to draw a circle in the xz plane, for instance, I'd write circle[x={(1,0,0)}, y={(0,0,1)}, x radius=1,y radius=1];
. But in my case, this doesn't seem to work and I have to guess/fudge the vectors and/or radius and am left with something that's not quite right.
What am I missing? Here's the output of the current code.
\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}