2

Well I'm preparing an article about trigonometry, unfortunately I'm not that much good with TikZ So I'm not able to draw it perfectly, So please some help so I can draw my circle ! and thanks in advance ! enter image description here

Here's the figure that I'd love to have it in my article !

3

2 Answers 2

4

enter image description here

\documentclass{article}

\usepackage{pgfplots}
\usetikzlibrary{intersections,angles,quotes}
\usepgfplotslibrary{fillbetween}
%\pgfplotsset{compat=1.17}

\begin{document}

\begin{tikzpicture}[scale=3]

%grid lines
\draw[
        step=.5cm,
        gray,
        very thin
        ] 
        (-1.4,-1.4) grid (1.4,1.4);
\filldraw[
            fill=blue!20,
            draw=red!50
            ] 
            (0,0) -- (3mm,0mm)
arc [
        start angle=0, 
        end angle=30, 
        radius=3mm] 
        -- cycle;
%axes
\draw[->] (-1.5,0) -- (1.5,0) coordinate (x axis);
\draw[->] (0,-1.5) -- (0,1.5) coordinate (y axis);

%axes label
\node [right]at (1.5,0)(x){$x$};    
\node [above]at (0,1.5){$y$};

%circle 
\draw (0,0) circle [
                    radius=1cm
                    ];
                    
%triangle height
\draw[
        very thick,
        orange
        ]
        (30:1cm) -- node[
                        left=1pt,
                        fill=white
                        ] 
                        {$\sin \alpha$} (30:1cm |- x axis);
                        
%triangle base
\draw[
        very thick,
        blue
        ]
        (30:1cm |- x axis) -- node[
                                    below=2pt,
                                    fill=white
                                    ] 
                                    {$\cos \alpha$} (0,0);

%intersection
\path [name path=upward line] (1,0) -- (1,1);
\path [name path=sloped line] (0,0) -- (30:1.5cm);
\draw [name intersections={of=upward line and sloped line, by=t}]
        [very thick,red] 
        (1,0) -- node [right=1pt,fill=white]
        {$\displaystyle \tan \alpha $} (t);
\draw (0,0) -- (t);

%x-ticks
\foreach \x/\xtext in {-1, 
                        -0.5/-\frac{1}{2},
                                         1}
\draw (\x cm,1pt) -- (\x cm,-1pt) node[
                                        anchor=north,
                                        fill=white
                                        ] 
                                        {$\xtext$};
%y-ticks
\foreach \y/\ytext in {-1, 
                        -0.5/-\frac{1}{2}, 
                            0.5/\frac{1}{2}, 
                                            1}
\draw (1pt,\y cm) -- (-1pt,\y cm) node[
                                        anchor=east,
                                        fill=white
                                        ] 
                                        {$\ytext$};
%arc angle
\draw (x) coordinate (A)-- 
        (0,0) coordinate (B)-- 
            (t) coordinate (C)
pic [
        draw,
        red, 
        "$\alpha$",
        angle radius=9mm
        ] 
        {angle};
\end{tikzpicture}

\end{document}
1
  • 1
    Yes it's perfect, thank you!! Commented Jul 15, 2020 at 15:22
4

Using the example in the pgf manual cited by @jsbibra you only have to make slight modifications and then get:

\documentclass[tikz]{standalone}

\usetikzlibrary{intersections}

\begin{document}
\begin{tikzpicture}[scale=3]
    \draw[step=.5cm,gray,very thin] (-1.4,-1.4) grid (1.4,1.4);
    \filldraw[fill=blue!20,draw=red] (0,0) -- (3mm,0mm)
    arc [start angle=0, end angle=30, radius=3mm] -- cycle;
    \node[red] at (15:2mm) {$\alpha$};
    \draw[->] (-1.5,0) -- (1.5,0) coordinate (x axis)node[right]{$x$};
    \draw[->] (0,-1.5) -- (0,1.5) coordinate (y axis)node[above]{$y$};
    \draw (0,0) circle [radius=1cm];
    \draw[very thick,orange]
    (30:1cm) -- node[left=1pt,fill=white] {$\sin \alpha$} (30:1cm |- x axis);
    \draw[very thick,blue]
    (30:1cm |- x axis) -- node[below=2pt,fill=white] {$\cos \alpha$} (0,0);
    \path [name path=upward line] (1,0) -- (1,1);
    \path [name path=sloped line] (0,0) -- (30:1.5cm);
    \draw [name intersections={of=upward line and sloped line, by=t}]
    [very thick,red] (1,0) -- node [right=1pt,fill=white]
    {$\displaystyle \tan \alpha$} (t);
    \draw (0,0) -- (t);
    \foreach \x/\xtext in {-1, -0.5/-\frac{1}{2}, 1}
    \draw (\x cm,1pt) -- (\x cm,-1pt) node[anchor=north,fill=white] {$\xtext$};
    \foreach \y/\ytext in {-1, -0.5/-\frac{1}{2}, 0.5/\frac{1}{2}, 1}
    \draw (1pt,\y cm) -- (-1pt,\y cm) node[anchor=east,fill=white] {$\ytext$};
\end{tikzpicture}
\end{document}

Which produces:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .