3

I'm using an xyz coordinate system to draw a 3D axis and a plane. I've labelled the plane using a circle. However, since the circle isn't projected onto the plane but "faces" the viewer, it breaks the 3D perspective.

Is there some way to project the circle onto the plane? I'd be happy even with a clever ellipse that works only for this specific case.

enter image description here

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}[x=0.5cm,y=0.5cm,z=-0.25cm]
% plane
\filldraw[fill=lightgray!50] (0,0) -- (xyz cs:y=3,z=0) -- (xyz cs:y=3,z=3) -- (xyz cs:y=0,z=3) -- cycle;
% axis
\draw[-stealth] (xyz cs:x=0) -- (xyz cs:x=4);
\draw[-stealth] (xyz cs:y=0) -- (xyz cs:y=4);
\draw[-stealth] (xyz cs:z=0) -- (xyz cs:z=4);
% plane label+marker
\node[circle, fill=black, inner sep=0pt, minimum size=6pt] at (xyz cs:y=1,z=1.5) (plane marker) {};
\node[anchor=north west] at (xyz cs:x=0,y=-1,z=0) (plane label) {plane};
\draw (plane label.west) to[out=180,in=-90] (plane marker);
\end{tikzpicture}
\end{document}

2 Answers 2

9

You can make use of the 3d library and instead of using a node (which won't be affected by the 3D transformation) draw a real circle and place a coordinate at its center:

\documentclass[tikz, border=10pt]{standalone}
\usetikzlibrary{3d}
\begin{document}
\begin{tikzpicture}[x=0.5cm,y=0.5cm,z=-0.25cm]
% plane
\filldraw[fill=lightgray!50] (0,0) -- (xyz cs:y=3,z=0) -- (xyz cs:y=3,z=3) -- (xyz cs:y=0,z=3) -- cycle;
% axis
\draw[-stealth] (xyz cs:x=0) -- (xyz cs:x=4);
\draw[-stealth] (xyz cs:y=0) -- (xyz cs:y=4);
\draw[-stealth] (xyz cs:z=0) -- (xyz cs:z=4);
% plane label+marker
% \node[circle, fill=black, inner sep=0pt, minimum size=6pt] at (xyz cs:y=1,z=1.5)  {};
\begin{scope}[canvas is yz plane at x=0]
    \fill (1,1.5) circle[radius=6pt]
        coordinate (plane marker);
\end{scope}
\node[anchor=north west] at (xyz cs:x=0,y=-1,z=0) (plane label) {plane};
\draw (plane label.west) to[out=180, in=-90] (plane marker);
\end{tikzpicture}
\end{document}

enter image description here

0
2

An alternative code can be this. The 3d library is loaded and is possible to use the canvas is yz plane at x=0:

\documentclass[tikz]{standalone}
\usetikzlibrary{3d} % Load the 3d TikZ library

\begin{document}
\begin{tikzpicture}[x=0.5cm,y=0.5cm,z=-0.25cm]
% plane
\filldraw[fill=lightgray!50] (0,0) -- (xyz cs:y=3,z=0) -- (xyz cs:y=3,z=3) -- (xyz cs:y=0,z=3) -- cycle;
% axis
\draw[-stealth] (xyz cs:x=0) -- (xyz cs:x=4);
\draw[-stealth] (xyz cs:y=0) -- (xyz cs:y=4);
\draw[-stealth] (xyz cs:z=0) -- (xyz cs:z=4);
% plane label+marker
\coordinate (plane marker) at (xyz cs:y=1,z=1.5);
\node[anchor=north west] at (xyz cs:x=0,y=-1,z=0) (plane label) {plane};
% Projecting the circle onto the plane
\begin{scope}[canvas is yz plane at x=0]
    \coordinate (proj) at (1,1.5);
    \filldraw[fill=black] (proj) circle (4pt);
\end{scope}
\draw (plane label.west) to[out=180,in=-90] (proj);
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .