6

I'm trying to draw an angle between two lines.

I have this code so far, but i cant draw a angle. How do I do it? I'm using PGF/TikZ.

\begin{figure}
   \begin{tikzpicture}
      \begin{axis}[
         ticks=none,
         axis lines = middle,
         axis line style={->},
         ymin=-1.5, ymax=1.5,
         xmin=-1.5, xmax=1.5,
         axis equal]
         \addplot[black, domain=0:0.7071] {x};
         \draw[black] (axis cs:0,0) circle [radius=1];
      \end{axis}
   \end{tikzpicture}
\end{figure}

Thanks.

8

The arc operation can be used here. The general syntax as recommended by the TikZ/PGF manual (thanks to @Tobi for the comment) is

\draw (<starting point>) arc [<options>];

with these options:

  • radius=<dim>
  • x radius=<dim>
  • y radius=<dim>
  • start angle=<deg>
  • end angle=<deg>
  • delta angle=<deg>

or a less readable version

\draw (<starting point>) arc (<start angle>:<end angle>:<radius>);

where <radius> can be a single length or <dim> and <dim> for different radii.

Code

\documentclass[border=2pt]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
  \begin{axis}[
      ticks=none,
      axis lines = middle,
      axis line style={->},
      ymin=-1.5, ymax=1.5,
      xmin=-1.5, xmax=1.5,
    axis equal]
    \addplot[black, domain=0:0.7071] {x};
    \draw[black] (axis cs:0,0) circle [radius=1];
    \draw (axis cs:.125,0)arc[radius=.25cm,start angle=0,end angle=45];
    % \draw (axis cs:.125,0)arc(0:45:.25cm); % same as above with different syntax
  \end{axis}
\end{tikzpicture}  
\end{document}

Output

enter image description here

  • 3
    Please note that the the official recommended syntax is arc [options]: “However, this syntax [using (α:β:r)] is harder to read, so the normal syntax [using options] should be preferred in general.” (pgfmanual.pdf, p. 144) So you may like to extend your answer ;-) – Tobi Jan 2 '14 at 23:43
  • Thanks! This was the best answer so far to what I was looking for. But actually I didn't want to use any dimensions, I mean cm, mm whatever. so I tried this: \draw (axis cs:0.5,0) arc [radius=50,start angle=0,end angle=45] which is exactly what I want! – David Jan 3 '14 at 21:24
  • @KevinC: I hope you don’t mind that I added some info :-) (btw. the @-notifications work only in comments, see this and that …) – Tobi Jan 4 '14 at 0:15
  • @Tobi: No, not at all. Thank you very much for improving the answer :) – Herr K. Jan 4 '14 at 0:28
4

With PSTricks. Like this?

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-eucl}
\begin{document}
\begin{pspicture}[showgrid](-2,-2)(4,4)
    \pstGeonode
        (1,1){B}
        ([nodesep=2,angle=60]B){A}
        ([nodesep=2,angle=20]B){C}
    \pscircle(B){2}
    \psline(A)(B)(C)
    \psarc[origin={B}](B){1}{(C)}{(A)}
\end{pspicture}
\end{document}

enter image description here

Version 2

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-node}
\begin{document}
\begin{pspicture}[showgrid](-2,-2)(2,2)
    \psline(-2,0)(2,0)
    \psline(0,-2)(0,2)
    \pnodes(0,0){B}(1;60){A}(1;20){C}
    \psline(A)(B)(C)
    \psarc[origin={B}](B){.2}{(C)}{(A)}
\end{pspicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.