I would like to draw bouquet of n circles. How can i draw it in Tikz?
rose with four petals is like i want to draw but with n petals.
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityI would like to draw bouquet of n circles. How can i draw it in Tikz?
rose with four petals is like i want to draw but with n petals.
Some inspiration for an answer:
\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{polaraxis}[grid=none, axis lines=none]
\addplot[mark=none,domain=0:360,samples=300] {cos(x*3)};
\end{polaraxis}
\end{tikzpicture}
\end{document}
which gives us
And courtesy of my buddy percusse:
\documentclass{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{polaraxis}
\addplot[mark=none,domain=0:360,samples=300] {cos(5*x)};
\end{polaraxis}
\end{tikzpicture}
\end{document}
It's important to observe that the secret relies in
cos(n*x)
where n
is the number of petals you want. But note that when n
is odd, you will end up with n
petals, and 2n
petals when n
is even. If somebody could improve the code, it would be great. :)
Update: tohecz provided me an alternate plot which surely helps us here. Although he claims it's not a smooth curve, it's good enough for me. :)
Let's replace
cos(n*x)
by
abs(cos(n*x/2))
and voilà!
\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{polaraxis}[grid=none, axis lines=none]
\addplot[mark=none,domain=0:360,samples=300] { abs(cos(6*x/2))};
\end{polaraxis}
\end{tikzpicture}
\end{document}
And we have:
Yay! :)
There are 4 options in PSTricks.
r = f(Θ)
in algebraicRadial distance is a function of angle in algebraic form.
\begin{pspicture}(-1,-1)(1,1)
\psplot[algebraic,polarplot,linecolor=red]{0}{TwoPi}{cos(3*x)}
\end{pspicture}
x = f(t)
and y = g(t)
in algebraicBoth x
and y
are functions of t
in algebraic form.
\begin{pspicture}(-1,-1)(1,1)
\psparametricplot[algebraic,linecolor=green]{0}{TwoPi}{cos(3*t)*cos(t)|cos(3*t)*sin(t)}
\end{pspicture}
r = f(Θ)
in RPNRadial distance is a function of angle in RPN form.
\begin{pspicture}(-1,-1)(1,1)
\psplot[polarplot,linecolor=blue]{0}{TwoPi RadtoDeg}{3 x mul cos}
\end{pspicture}
x = f(t)
and y = g(t)
in RPNBoth x
and y
are functions of t
in RPN form.
\begin{pspicture}(-1,-1)(1,1)
\psparametricplot[linecolor=orange]{0}{TwoPi RadtoDeg}{3 t mul cos t PtoC}
\end{pspicture}
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot}
\psset{plotpoints=150}
\def\Label#1{\uput[90](0,1){\tiny$n=#1$}}
\def\Draw#1{%
% r = f(Θ) in algebraic
\begin{pspicture}(-1,-1)(1,1)
\psplot[algebraic,polarplot,linecolor=red]{0}{TwoPi}{cos(#1*x)}
\Label{#1}
\end{pspicture}
% x = f(t) and y = g(t), both are in algebraic
\begin{pspicture}(-1,-1)(1,1)
\psparametricplot[algebraic,linecolor=green]{0}{TwoPi}{cos(#1*t)*cos(t)|cos(#1*t)*sin(t)}
\Label{#1}
\end{pspicture}
% r = f(Θ) in RPN
\begin{pspicture}(-1,-1)(1,1)
\psplot[polarplot,linecolor=blue]{0}{TwoPi RadtoDeg}{#1 x mul cos}
\Label{#1}
\end{pspicture}
% x = f(t) and y = g(t), both are in RPN
\begin{pspicture}(-1,-1)(1,1)
\psparametricplot[linecolor=orange]{0}{TwoPi RadtoDeg}{#1 t mul cos t PtoC}
\Label{#1}
\end{pspicture}}
\begin{document}
\multido{\i=1+1}{5}{\Draw{\i}}
\end{document}
cos(n*x)
as the function. The remaining update in his answer was fully ignored. :-) Sorry Paulo for my bad!
Nov 1, 2013 at 6:22