13

I would like to draw bouquet of n circles. How can i draw it in Tikz?

enter image description here

rose with four petals is like i want to draw but with n petals.

5
  • 1
    Welcome to TeX.SX. Questions about how to draw specific graphics are really not reasonable questions to ask on the site. Please post a minimal compilable document showing what you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. Also some graphic of what you want to achieve might be helpful. Oct 31, 2013 at 13:27
  • Please provide us with a MWE (minimal working example) to show your effort. The last resort, just provide us with the hand-made sketch to show what you want to draw. Oct 31, 2013 at 13:27
  • 2
    Welcome to TeX.SX! Could you provide more description, or at least an example of image? With a bit of more information we might help you better. Oct 31, 2013 at 13:28
  • In addition to the answers already given a post on TeXample may be helpful. Oct 31, 2013 at 17:13
  • This is a great question. I needed to draw the same thing myself and found this very useful. Jul 28 at 17:18

2 Answers 2

20

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

Image 1

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}

Image 2

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:

Image 3

Yay! :)

1
  • Very nice, Paulo +3 ;-) Oct 31, 2013 at 15:59
9

There are 4 options in PSTricks.

r = f(Θ) in algebraic

Radial 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 algebraic

Both 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 RPN

Radial 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 RPN

Both 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}

Complete Code

\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}

enter image description here

6
  • There is one more option. I will let you know later. This comment will be deleted later. Oct 31, 2013 at 15:32
  • n=4 is not correct
    – percusse
    Oct 31, 2013 at 21:27
  • @percusse: Why? TikZ also produces the same output. Oct 31, 2013 at 21:33
  • 1
    n=4 does not give 4 petals. read paulos answer
    – percusse
    Nov 1, 2013 at 6:03
  • 1
    @percusse: Oh I see. Actually I did not focus on the function when writing the code. I just skimmed through Paulo's answer and took 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

You must log in to answer this question.

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