Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
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. –  Benedikt Bauer Oct 31 '13 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. –  In PSTricks we trust Oct 31 '13 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. –  Claudio Fiandrino Oct 31 '13 at 13:28
    
In addition to the answers already given a post on TeXample may be helpful. –  Mark Wibrow Oct 31 '13 at 17:13

2 Answers 2

up vote 16 down vote accepted

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! :)

share|improve this answer
    
Thank you so much ! –  Serap Gurer Oct 31 '13 at 14:28
    
Very nice, Paulo +3 ;-) –  karlkoeller Oct 31 '13 at 15:59
    
@karlkoeller: thanks Karl. :) –  Paulo Cereda Oct 31 '13 at 16:06

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

share|improve this answer
    
There is one more option. I will let you know later. This comment will be deleted later. –  In PSTricks we trust Oct 31 '13 at 15:32
    
n=4 is not correct –  percusse Oct 31 '13 at 21:27
    
@percusse: Why? TikZ also produces the same output. –  In PSTricks we trust Oct 31 '13 at 21:33
1  
n=4 does not give 4 petals. read paulos answer –  percusse Nov 1 '13 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! –  In PSTricks we trust Nov 1 '13 at 6:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.