您好,我想绕 y 轴旋转以下 tikz 图像,以便连接波峰(顶部)的线条更垂直一些。那么本质上如何绕 y 轴旋转以下 3d tikz 图像约 10 度左右。
begin{tikzpicture}[xscale=1]
\draw (0,0,0) sin (1,1,0) cos (2,0,0) sin (3,-1,0) cos (4,0,0) sin (5,1,0) cos
(6,0,0) sin (7,-1,0);
\draw (0,0,4) sin (1,1,4) cos (2,0,4) sin (3,-1,4) cos (4,0,4) sin (5,1,4) cos
(6,0,4) sin (7,-1,4);
\draw (0,0,-2) sin (1,1,-2) cos (2,0,-2) sin (3,-1,-2) cos (4,0,-2) sin
(5,1,-2) cos (6,0,-2) sin (7,-1,-2);
\draw (0,0,2) sin (1,1,2) cos (2,0,2) sin (3,-1,2) cos (4,0,2) sin (5,1,2) cos
(6,0,2) sin (7,-1,2);
\draw (1,1,-2) -- (1,1,4);
\draw (5,1,-2) -- (5,1,4);
\end{tikzpicture}
答案1
类似这样?我将z
轴向量重新定义为z={(0.1,0.3)}
。请随意更改这些数字。
\documentclass[tikz,border=1cm]{standalone}
\begin{document}
\begin{tikzpicture}[z={(0.1,0.3)},xscale=1]
\draw (0,0,0) sin (1,1,0) cos (2,0,0) sin (3,-1,0) cos (4,0,0) sin (5,1,0) cos
(6,0,0) sin (7,-1,0);
\draw (0,0,4) sin (1,1,4) cos (2,0,4) sin (3,-1,4) cos (4,0,4) sin (5,1,4) cos
(6,0,4) sin (7,-1,4);
\draw (0,0,-2) sin (1,1,-2) cos (2,0,-2) sin (3,-1,-2) cos (4,0,-2) sin
(5,1,-2) cos (6,0,-2) sin (7,-1,-2);
\draw (0,0,2) sin (1,1,2) cos (2,0,2) sin (3,-1,2) cos (4,0,2) sin (5,1,2) cos
(6,0,2) sin (7,-1,2);
\draw (1,1,-2) -- (1,1,4);
\draw (5,1,-2) -- (5,1,4);
\end{tikzpicture}
\end{document}
答案2
首先,您可以通过定义 x、y 和 z 向量来更改三维图的外观:
\tikzstyle{isometric}=[x={(0.710cm,-0.410cm)},y={(0cm,0.820cm)},z={(-0.710cm,-0.410cm)}]
\tikzstyle{manual} =[x={(1cm,0cm)},y={(0cm,1cm)},z={(0.4cm,0.7cm)}]
\tikzstyle{dimetric} =[x={(0.935cm,-0.118cm)},y={(0cm,0.943cm)},z={(-0.354cm,-0.312cm)}]
并将这些样式用于你的 tikzpicture,就像你使用 xscale 一样:
\begin{tikzpicture}[isometric]
否则,您可以看看 tikz-3dplot 包,它允许您使用旋转执行相同的操作(以及更多有用的东西,但对您来说可能有点过度):
\usepackage{tikz-3dplot}
\tdplotsetmaincoords{10}{0}
\begin{tikzpicture}[xscale=1,tdplot_main_coords ]