我刚刚开始使用 tikz,我正在尝试创建一个直角三角形。但是,当我尝试绘制一个角度时,它总是被挤压。有没有办法将它向前移动以减少挤压(例如angle eccentricity
)?
我的代码:
% tikz packages used:
% \usetikzlibrary{arrows.meta, quotes, angles}
\begin{diagram}[scale=0.4]
% coordinates
\coordinate (A) at (0, 0);
\coordinate (B) at (19, 0);
\coordinate (C) at (19, 5);
% draw sides of vector triangle
\draw[-{Triangle[open]}, darkred, ultra thick]
(A) -- (B)
node[midway, below, black]{$\vect r_x$};
\draw[-{Triangle[open]}, darkred, ultra thick]
(B) -- (C)
node[midway, right, black]{$\vect r_y$};
\draw[-{Triangle[open]}, darkred, ultra thick]
(A) -- (C)
node[midway, above left, black]{$\vect r$};
% label stuff
\pic [draw, ->, "$\theta$", angle eccentricity=5]{angle=B--A--C};
\pic [draw, angle eccentricity=.5]{right angle=A--B--C};
\end{diagram}
结果:
答案1
像这样:
代码:
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\pgfmathsetmacro{\a}{6*sqrt(3)}
\draw (0,0)--(6,0);
\draw (0,0)--(6,\a);
\foreach \i in {.5,.75,...,5.5}
\draw[->] (\i,0) arc (0:60:\i);
\draw[->,red] (5.5,0) arc (0:60:5.5) node[midway,fill=white] () {$60^\circ$};
\end{tikzpicture}
\end{document}
答案2
找到了这里!
只需改变线路
\pic [draw, ->, "$\theta$", angle eccentricity=5]{angle=B--A--C};
到
\pic [draw, ->, "$\theta$", angle eccentricity=1.25, angle radius=2cm]{angle=B--A--C};