I would like to know how one can draw teaching material of trigonometry in LaTeX? Namely, I was looking how to draw 405 degree angle i.e. unit circle, a line segment to the circumference and a spiral from x-axis to the line segment that goes around the circle over once. Also, the spiral should end to a small arrow which shows that I meant 405 degree angle rather than -405 degree angle.
5 Answers
Here's how you can do this using PGFPlots:
\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
axis equal image,
enlargelimits,
xtick=\empty, ytick=\empty,
data cs=polar,
samples=100
]
\addplot [thick, black, smooth, domain=0:360] {1};
\addplot [thick, red, -latex, smooth, domain=0:405] {0.3+x/2000} node [pos=0.9, anchor=south west] {$405^\circ$};
\addplot [thick, black] coordinates {(0,0) (405,1)};
\end{axis}
\end{tikzpicture}
\end{document}
Here is a Tikz version without using pgfplots
.
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}[x=3cm,y=3cm,axis/.style={-latex,very thin},thick]
\draw[axis] (-1,0) -- (1,0);
\draw[axis] (0,-1) -- (0,1);
\draw (0,0) circle(0.8) -- (405:0.8);
\draw [red,->,domain=0:405,smooth,samples=100]
plot ({\x}: {0.3 + \x/3000}) node[right] {$405^\circ$};
\end{tikzpicture}
\end{document}
Note that the node pos
parameter does not work with tikz's plot
command, so if you need positionning nodes on the path, it is better to use pgfplots
.
Here is a simple MetaPost solution.
prologues := 3;
outputtemplate := "%j%c.eps";
input TEX;
beginfig(1);
theta = 405;
path xx, yy, s, c;
xx = (left--right) scaled 5cm;
yy = (down--up) scaled 5cm;
drawarrow xx withcolor .7 white;
drawarrow yy withcolor .7 white;
c = fullcircle scaled 8cm;
s = (1.2cm,0) for t=1 step 1 until theta-eps: -- (1.2cm + (t/500)*cm,0) rotated t endfor;
drawoptions(withpen pencircle scaled 1);
linejoin := mitered;
draw c;
draw origin -- point theta/45 of c;
drawarrow s withcolor .8 red;
label.rt(TEX("$" & decimal theta & "^{\circ}$"), point .95 theta of s) withcolor .8 red;
endfig;
end.
Asymptote
version using polargraph
to draw the Archimedean spiral:
// spiral.asy:
//
settings.tex="pdflatex";
size(5cm);
import graph;
import fontsize;
defaultpen(fontsize(9pt));
texpreamble("\usepackage{siunitx}\usepackage{lmodern}");
pen linePen=darkblue+0.8bp;
pen thinPen=linewidth(0.7*linewidth())+gray(0.3);
real r=1, phi=405, rphi=radians(phi), d=0.2;
draw(Circle(0,r),linePen);
draw(E--(0,0)--rotate(phi)*E,linePen);
guide s=polargraph(new real(real t){return d*(1+t/rphi);},0,rphi);
draw(s,thinPen,Arrow(size=3));
label("$\ang{"+string(phi)+"}$",point(s,length(s)),E);
//
// to get spiral.pdf, run
// asy spiral.asy
//
With the mfpic
package. To draw the spiral representing the angle, I used a simple polar function. Notice the \trimpath{ , }
macro which trims the spiral at its extremities, to allow it not to overlap the x-axis and the radius at these points.
\documentclass{scrartcl}
\usepackage[metapost, mplabels]{mfpic}
\mfpverbtex{%&latex
\documentclass{scrartcl}
\begin{document}}
\setlength{\mfpicunit}{1cm}
\opengraphsfile{\jobname}
\begin{document}
\begin{mfpic}[4]{-1.25}{1.25}{-1.25}{1.25}
\doaxes{xy}
\penwd{1.2bp}
\circle{origin, 1}
\lines{origin, \plr{(1, 405)}}
\store{big_angle}\plrfcn{0, 405, 1}{.25 + .15/360 t}
\arrow[cred]\draw[red]\trimpath{.5bp, 1.2bp}\mfobj{big_angle}
\tlpointsep{3bp}
\tlabelcolor{red}
\tlabel[cl]{point 382.5 of big_angle}{$405^\circ$}
\end{mfpic}
\closegraphsfile
\end{document}
To be processed with (PDF)LaTeX, then MetaPost, and then (PDF)LaTeX again.