我需要在 \tdplotsetmaincoords{ }{ }(仰角和方位角)中选择视角,以便我的绘图最终看起来像下面的图。我希望完全通过视角来完成此操作,而不是重新标记 x、y、z 坐标。
\documentclass{article}
\usepackage{tikz} %TikZ is required for this to work. Make sure this exists before the next line
%\usepackage{3dplot} %requires 3dplot.sty to be in same directory, or in your LaTeX installation
\usepackage{tikz-3dplot}
\usepackage[active,tightpage]{preview} %generates a tightly fitting border around the work
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{2mm}
\begin{document}
%Angle Definitions
%-----------------
\tdplotsetmaincoords{60}{110}
%start tikz picture, and use the tdplot_main_coords style to implement the display
%coordinate transformation provided by 3dplot
\begin{tikzpicture}[scale=5,tdplot_main_coords]
%draw the main coordinate system axes
\draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
\draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
\draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};
\end{tikzpicture}
\end{document}
答案1
您可以根据屏幕坐标指定每个 3D 轴的实际尺寸(缩放之前)。
\documentclass{article}
\usepackage{tikz} %TikZ is required for this to work. Make sure this exists before the next line
%\usepackage{3dplot} %requires 3dplot.sty to be in same directory, or in your LaTeX installation
\usepackage{tikz-3dplot}
\usepackage[active,tightpage]{preview} %generates a tightly fitting border around the work
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{2mm}
\begin{document}
%Angle Definitions
%-----------------
\tdplotsetmaincoords{60}{110}
%start tikz picture, and use the tdplot_main_coords style to implement the display
%coordinate transformation provided by 3dplot
\begin{tikzpicture}[scale=5]
\pgfsetxvec{\pgfpoint{.866cm}{.5cm}}
\pgfsetyvec{\pgfpoint{0cm}{1cm}}
\pgfsetzvec{\pgfpoint{.866cm}{-.5cm}}
%draw the main coordinate system axes
\draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
\draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
\draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};
\end{tikzpicture}
\end{document}
这是使用 3dplot 的解决方案。
\documentclass[border=2pt]{standalone}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usepackage{tikz-3dplot}
\begin{document}
\Large
\tdplotsetmaincoords{60}{45}
\begin{tikzpicture}[scale=1in,tdplot_main_coords]
\tdplotsetrotatedcoords{0}{90}{90}
\begin{scope}[tdplot_rotated_coords]
\draw[thick,-latex] (0,0,0) -- (.1,0,0) node[below] {x};
\draw[thick,-latex] (0,0,0) -- (0,.1,0) node[left] {y};
\draw[thick,-latex] (0,0,0) -- (0,0,.1) node[below] {z};
\end{scope}
\end{tikzpicture}
\end{document}