1 Answer
As I alluded to, you basically only have to copy an example from section 22.5 in the manual for TikZ and replace the equations with the ones you want. In the first example note that the r
indicates that radians should be used, by default the trigonometric functions in pgf
uses degrees.
I also added an example with pgfplots
, which is convenient if you need axes.
\documentclass[border=4mm]{standalone}
\usepackage{pgfplots} % also loads tikz
\begin{document}
\begin{tikzpicture}
\draw[domain=0:pi,variable=\t,samples=200]
plot ({cos(\t r)^2*(-1 + 4*sin(\t r)^2)},{cos(\t r)*sin(\t r)*(-1 + 4*sin(\t r)^2)});
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
trig format=rad,
domain=0:pi,
samples=200,
width=4cm,
axis equal]
\addplot [black] ({cos(x)^2*(-1 + 4*sin(x)^2)},{cos(x)*sin(x)*(-1 + 4*sin(x)^2)});
\end{axis}
\end{tikzpicture}
\end{document}
-
Thank you so much! The problem is that I can't figure out why the package pgfplots '' is not found ''.. Commented Apr 16, 2016 at 20:33
-
@AndreaLeo Because it's not installed presumably. Anyway, if all you need is the trefoil itself, use the first example, and replace
pgfplots
withtikz
. Commented Apr 16, 2016 at 20:40
pgfmanual.pdf
helps.tikzpicture
environment now. Or, if not, then the answers provided to your other questions have not been of much help to you.