如何在 tikz 中绘制此图形

如何在 tikz 中绘制此图形
\documentclass[border=1cm]{standalone}
    
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
    \draw [->] (0,0)--(5,0) node[right]{$X$};
    \draw [->] (0,0)--(0,5) node[above]{$Y$};
    \draw[thick]  (4,0)--node [right] {$P(r,\theta)$}(2.5,4);
    \node at (4,-0.3){$L$};
    \node at (0,-0.3) {$O$};
    \draw[thick] (0,0) -- node [left] {$r$}(3.5,4) ;
    \draw (3,3) arc (-35:-120:0.5);
    \draw (3.3,3.3) arc (0:120:0.5);
    \draw (1,0) arc (0:45:1);      
\end{tikzpicture}
\end{document}          

输出:

在此处输入图片描述

它看起来应该是这样的:

在此处输入图片描述

答案1

如果你有很多这样的数字,那么 tkz-euclide可以帮助你

\documentclass{standalone} 
\usepackage{tkz-euclide}
\begin{document} 
\begin{tikzpicture}
  \tkzInit[xmax=6, ymax=6]
\tkzDefPoints{0/0/O,5/0/L,4/5/M,6/0/x}
\tkzDrawX[label=$X$] \tkzDrawY[label=$Y$]
\tkzDrawLines[add=0 and 0.4](O,M L,M)
\tkzLabelSegment(O,M){$r$}
\tkzLabelSegment(M,L){$P(r,\theta)$}
\tkzDefPointOnLine[pos=1.2](O,M) \tkzGetPoint{m1}
\tkzDefPointOnLine[pos=1.2](L,M) \tkzGetPoint{m2}
\tkzMarkAngles[<->](L,O,M O,M,L x,L,M m1,M,m2) 
\tkzLabelAngle[pos=1.2](L,O,M){$\theta$}
\tkzLabelAngle[pos=1.2](O,M,L){$\beta$}
\tkzLabelAngle[pos=1.2](x,L,M){$\Phi$}
\tkzLabelAngle[pos=1.2](m1,M,m2){$\beta$}
\tkzLabelPoints(O,L)
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

在此处输入图片描述

\documentclass[a4paper, 12pt]{article}

\usepackage{tikz}
\usetikzlibrary{angles, quotes, intersections}

\begin{document}

       \begin{tikzpicture}
        \draw [->]  (0,0)   coordinate[label=below:${O}$]   (origin)--
                    (5,0)   coordinate[label=right:${X}$]   (x);
        \draw [->]  (0,0)--
                    (0,5)   coordinate[label=above:${Y}$]   (y);
        \draw[thick, name path=ll1]         
                    (4,0)   coordinate[label=below:${L}$](l)--
                    node [right] {$P(r,\theta)$}(2.5,4) coordinate(l1);

        \draw[thick, name path=rr1] 
                    (0,0) -- 
                    node [left] {$r$}(3.5,4) coordinate(r1) ;

        \pic [draw, 
                thick, 
                <->,
                angle radius=8mm,
                angle eccentricity=1.3,
                "$\theta$"]     {angle = x--origin--r1};
        \pic [draw, 
                thick, 
                <->,
                angle radius=6mm,
                angle eccentricity=1.3,
                "$\phi$"]     {angle = x--l--l1};

        \path [name intersections={of=rr1 and ll1, by=p}];

        \pic [draw, 
                thick, 
                <->,angle radius=6mm,
                angle eccentricity=1.3,
                "$\beta$"]     {angle = r1--p--l1};
        \pic [draw, 
                thick, 
                <->,
                angle radius=6mm,
                angle eccentricity=1.4,
                "$\beta$"]     {angle = origin--p--l};


    
       \end{tikzpicture}          

\end{document}

答案3

不错的 @js bibra 答案的一个小变化(+1):

  • 所有角度的通用风格,
  • 使用的是极坐标
\documentclass[border=3.141592]{standalone}
\usepackage{tikz}
\usetikzlibrary{angles, arrows.meta, 
                intersections,
                quotes}

\begin{document}
    \begin{tikzpicture}[
           > = {Straight Barb[scale=0.8]},
Angle/.style = {draw, <->,
                angle radius=5mm,
                angle eccentricity=1.3,
                font=\scriptsize},
every edge quotes/.append style = {inner sep=1pt,text depth=0.5ex, pos=0.35}
                        ]
% axis
\draw [->]  (-0.4,0) -- (5,0) coordinate[label=below left:$x$] (x);
\draw [->]  (0,-0.4) -- (0,5) coordinate[label=below left:$y$] (y);
% triangle
\draw[semithick, name path=A]
    (0,0)   coordinate[label=below left:O] (o)
            to ["$r$"] ++ (45:4.9) coordinate (r1);
\draw[semithick, name path=B]
    (4,0)   coordinate[label=below:L] (l)
            to ["${P(r,\theta)}$" ']  ++ (120:4) coordinate (r2);
% angles at x-axis
\pic [Angle, "$\theta$"]    {angle = x--o--r1};
\pic [Angle, "$\phi$"]      {angle = x--l--r2};
% intersection with angles
\path [name intersections={of=A and B, by=i}]
    pic [Angle, "$\beta$"]     {angle = r1--i--r2}
    pic [Angle, "$\beta$"]     {angle = o--i--l};
    \end{tikzpicture}

在此处输入图片描述

答案4

使用tzplot包裹:

在此处输入图片描述

\documentclass[tikz]{standalone}
    
\usepackage{tzplot}

\begin{document}

\begin{tikzpicture}[font=\scriptsize]
\tzaxes*(-.5,-.5)(5,5){$X$}{$Y$}
\tzcoors(4,0)(L)(2.5,4)(B)(0,0)(O)(3.5,4)(D);
\tzline[thick]"LB"(L){$P(r,\theta)$}[pos=.4,r](B)
\tzline[thick]"OD"(O){$r$}[pos=.4,l](D)
\tzXpoint{LB}{OD}(X)
\tzanglemark[<->](B)(X)(D){$\phi$}[pos=1.3](6mm)
\tzanglemark[<->](L)(X)(O){$\phi$}[pos=1.3](6mm)
\tzanglemark[<->](L)(O)(D){$\theta$}[pos=1.3](6mm)
\tzanglemark[<->](5,0)(L)(B){$\Psi$}[pos=1.3](6mm)
\tznode(L){$L$}[br]
\tznode(O){$O$}[bl]
\tznode(2,1){$r=f(\theta)$}
\end{tikzpicture}

\end{document}

相关内容