如何绘制角 theta 并在第一象限中从原点开始的两条线之间放置一个角 theta。
下面是我的代码
\begin{center}
\begin{tikzpicture}[domain=0:4]
\draw[very thin,color=gray] (-0.1,-0.9) grid (3.9,3.9);
\draw[->] (-0.2,0) -- (4.2,0) node[right] {$x$};
\draw[->] (0,-1.2) -- (0,4.2) node[above] {$y$};
\draw[color=red] plot (\x,\x/2) node[below=2pt] {$\underline{x}$};
\draw[color=blue] plot (\x,\x) node[above=2pt] {$Q\underline{x}$};
\draw[ultra thick,black] ([shift=(30:0.5cm)]2,1) arc (30:60:1.6cm);
\end{tikzpicture}
\end{center}
答案1
使用angles
TikZ 库并用简单路径绘制线条\draw (<coordinate 1>) -- (<coordinate 2>)
::
\documentclass[margin=3mm, tikz]{standalone}
\usetikzlibrary{angles,
quotes}
\begin{document}
\begin{tikzpicture}
\draw[very thin,color=gray] (-0.1,-0.9) grid (3.9,3.9);
\draw[->] (-0.2,0) -- (4.2,0) node[right] {$x$};
\draw[->] (0,-1.2) -- (0,4.2) node[above] {$y$};
%
\coordinate (O);
\draw[red] (O) -- (4,2) coordinate[label=below:$\underline{x}$] (x);
\draw[blue] (O) -- (4,4) coordinate[label=above:$Q\underline{x}$] (q);
%
\pic [draw, thick, <->,
angle radius=16mm,angle eccentricity=1.1,"$\theta$"] {angle = x--O--q};
\end{tikzpicture}
\end{document}
或者画一条线作为函数:
\documentclass[margin=3mm, tikz]{standalone}
\usetikzlibrary{angles,
quotes}
\begin{document}
\begin{tikzpicture}[domain=0:4]
\draw[very thin,color=gray] (-0.1,-0.9) grid (3.9,3.9);
\draw[->] (-0.2,0) -- (4.2,0) node[right] {$x$};
\draw[->] (0,-1.2) -- (0,4.2) node[above] {$y$};
%
\coordinate (O);
\draw[red] plot (\x,\x/2) coordinate[label=below:$\underline{x}$] (x);
\draw[blue] plot (\x,\x) coordinate[label=above:$Q\underline{x}$] (q);
%
\pic [draw, thick, <->,
angle radius=16mm,angle eccentricity=1.1,"$\theta$"] {angle = x--O--q};
\end{tikzpicture}
\end{document}
结果和以前一样。