在三维笛卡尔平面中表示 3 个点(也用负坐标)

在三维笛卡尔平面中表示 3 个点(也用负坐标)

我正在尝试在 3D 笛卡尔平面中表示 3 个点。我可以绘制笛卡尔平面,但我无法制作网格并将平面的各个部分涂成黄色、橙色和蓝色。你能帮助我吗?

\documentclass{standalone}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}[x=1pt, y=1pt, z=-0.5pt]  % Agh
% Let's draw some 3D axes
\coordinate (x) at (100,0,0);
\coordinate (y) at (0,100,0);
\coordinate (z) at (0,0,100);
\foreach \axis in {x,y,z}
\draw[-latex] (0,0,0) -- (\axis);

\end{tikzpicture}

\end{document}

在此处输入图片描述

答案1

这应该可以让你开始

\documentclass[]{article}
\usepackage{tikz}
\usetikzlibrary{3d}
\usetikzlibrary{calc}

\begin{document}

 \begin{tikzpicture} [x={(-0.6cm,-0.4cm)}, y={(1cm,0cm)}, z={(0cm,1cm)}, scale=1]
   \begin{scope}[canvas is zy plane at x=0]
     \fill[blue, opacity = 0.2] (0, 0) rectangle (6, 6);
     \draw[gray!40] (0, 0) grid (6, 6);
   \end{scope}

   \begin{scope}[canvas is zx plane at y=0]
     \fill[orange, opacity = 0.2] (0, 0) rectangle (6, 8);
     \draw[gray!40] (0, 0) grid (6, 8);
     \draw[black, -latex] (0, 0) -- (6.5, 0) node[left] {$z$};

     \draw[gray, -latex] (0, 0) -- (-3.5, 0);
     \foreach \z in {1,...,6} \draw[] (\z, -0.1) -- (\z, 0.1) node[left]{\z};
     \foreach \z in {-3,...,-1} \draw[gray] (\z, -0.1) -- (\z, 0.1) node[left]{\z};

   \end{scope}

   \begin{scope}[canvas is yx plane at z=0]
     \fill[yellow, opacity = 0.2] (0, 0) rectangle (6, 8);
     \draw[gray!40] (0, 0) grid (6, 8);

     \draw[black, -latex] (0, 0) -- (6.5, 0) node[above] {$y$};
     \draw[black, -latex] (0, 0) -- (0, 8.5) node[above] {$x$};

     \draw[gray, -latex] (0, 0) -- (0, -8.5);
     \foreach \x in {0,...,8} \draw[] (-0.1, \x) -- (0.1, \x) node[right]{\x};
     \foreach \x in {-8,...,-1} \draw[gray] (-0.1, \x) -- (0.1, \x) node[right]{\x};

     \draw[gray, -latex] (0, 0) -- (-4.5, 0);
     \foreach \y in {1,...,6} \draw[] (\y, -0.1) -- (\y, 0.1) node[below]{\y};
     \foreach \y in {-4,...,-1} \draw[gray] (\y, -0.1) -- (\y, 0.1) node[below]{-\y};
   \end{scope}

   \fill[black] (2, 4, 3) circle (0.05) node[above]{$P$};
   \draw[red, thick] (0, 4, 0) -- (2, 4, 0);
   \draw[blue, thick] (2, 4, 0) -- (2, 4, 3);
   \draw[green, thick] (2, 0, 0) -- (2, 4, 0);

 \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容