Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
Welcome to TeX.SX!. Read this to familiarize further with our format. –  OSjerick Jan 2 at 18:51
2  
Similarly to Automatically draw and labels angles of a triangle in TikZ, I think \tkzMarkAngle is very useful for this. –  Claudio Fiandrino Jan 2 at 20:03
2  
@ClaudioFiandrino Don't forget TikZ 3.0.0: Label angle with tikz... –  Paul Gaborit Jan 2 at 23:30
    
@PaulGaborit: absolutely right!! It's really time to switch to the new release ;) –  Claudio Fiandrino Jan 3 at 7:39
    
Please do us a favour and change your username to something more telling than “user1234”. –  Tobi Jan 4 at 0:09

2 Answers 2

up vote 6 down vote accepted

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

share|improve this answer
2  
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 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 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 at 0:15
    
@Tobi: No, not at all. Thank you very much for improving the answer :) –  Kevin C Jan 4 at 0:28

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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