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 am trying to draw a closed liquid-droped shaped curve using TikZ, but I don't know how. I tried to draw it using coordinates but I don't think that this is the solution. I am using

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{figure}[H]
\centering
\begin{tikzpicture}
%\draw[very thick] (0,4) to [out=90,in=195] (0.1,3.9);
%\draw [shorten >=-1cm,shorten <=-1cm] (0,3) to [bend right=5](0.1,2.9);
\draw[orange, very thick] (0,4) -- (-0.1,3.5) -- (-0.3,3) -- (-0.65,2.7) -- (-0.55,2) -    - (-0.2,1.2) -- (0,0) -- (0.2,0.4) -- (1,1) -- (0.8,2.3) -- (0.5,2.8) -- (0.25,3.5) -- (0.1,4);
\end{tikzpicture}
\caption{Avalanche Multiplication}%
\label{fig:avalanche}%
\end{figure}
\end{document}

liquid-droped shape

share|improve this question

3 Answers 3

up vote 11 down vote accepted
\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{figure}[h]
\centering
\begin{tikzpicture}

\draw[very thick, orange] (-0.1,5) .. controls (-4,-2) and (4,-2) .. (0.1,5);
\node at (0,3) {$+$};
\node at (0,2) {$+$};
\node at (0.5,2.5) {$-$};
\node at (-0.5,2.5) {$+$};
\node at (0.5,.5) {$-$};
\node at (-0.5,1.5) {$-$};
\node at (0.5,1) {$-$};
\node at (0.5,2.5) {$-$};
\node at (-0.5,.5) {$+$};
\end{tikzpicture}
\caption{Avalanche Multiplication}%
\label{fig:avalanche}%
\end{figure}
\end{document}

enter image description here

share|improve this answer
    
Does the plus sign really need in math mode? –  stalking is prohibited Sep 22 '12 at 9:27
2  
@GarbageCollector: Ah! only personal preference. It looks good IMO (I am not partial, you know. Whatever is true for -, will be true for + ;). –  Harish Kumar Sep 22 '12 at 9:29
    
Thank you very much!!!That was exactly what I was looking for!!! –  Thanos Sep 22 '12 at 9:37

Are you perhaps interested in something like:

enter image description here

Similar results could be achieved by means of the hobby package. Here is the code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{hobby}
\begin{document}

\begin{figure}[H]
\centering
\begin{tikzpicture}[use Hobby shortcut]
\draw[orange, very thick] (0,4) .. (-0.1,3.5) .. (-0.3,3) .. (-0.65,2.7) .. (-0.55,2) .. (-0.2,1.2) .. (0,0) .. (0.2,0.4) .. (1,1) .. (0.8,2.3) .. (0.5,2.8) .. (0.25,3.5) .. cycle;

\foreach \place/\el in {{(0,1.2)/+},{(0,3)/-},{(0.5,2.5)/+},{(0.7,1)/-},{(-0.2,2.5)/-},{(0.1,2)/+},{(0.6,1.5)/+}}
\node at \place {\ensuremath{\el}};
\end{tikzpicture}
\caption{Avalanche Multiplication}%
\label{fig:avalanche}%
\end{figure}
\end{document}

From the comments seems clear I misunderstood the question; a belated attempt to remedy (of course with hobby) :):

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{hobby}
\begin{document}

Completely closed:
\begin{center}
\begin{tikzpicture}
\draw[orange, very thick] (0,4) to[curve through={(-0.45,2)..(-0.9,0) .. (0.9,0) .. (0.45,2)}] (0,4);

\foreach \place/\el in {{(0,1.2)/-},{(0,2.8)/-},{(-0.5,0.8)/+},{(0.55,1)/-},{(-0.2,1.7)/-},{(0.1,2)/+},{(0.55,1.5)/+},{(0.2,0.5)/+},{(-0.2,0.2)/-}}
\node at \place {\ensuremath{\el}};
\end{tikzpicture}
\end{center}

Not closed:
\begin{center}
\begin{tikzpicture}
\draw[orange, very thick] (-0.035,4) to[curve through={(-0.45,2)..(-0.9,0) .. (0.9,0) .. (0.45,2)}] (0.035,4);

\foreach \place/\el in {{(0,1.2)/-},{(0,2.8)/-},{(-0.5,0.8)/+},{(0.55,1)/-},{(-0.2,1.7)/-},{(0.1,2)/+},{(0.55,1.5)/+},{(0.2,0.5)/+},{(-0.2,0.2)/-}}
\node at \place {\ensuremath{\el}};
\end{tikzpicture}
\end{center}

\end{document}

Result:

enter image description here


Since Garbage Collector posted a very nice PSTricks gif animation, it sounds to me that we should have also a TikZ-based version. Basically, the standalone class with the tikz option allows to create several pdf pages, the base of the animation. The + and - signs change position in each page because their coordinates are generated by random numbers, the function rnd which generates number from 0 to 1. That's why each time a random number is created, it is multiplied by a constant factor that amplifies and bounds the positions in which each sign will be placed.

\documentclass[tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{hobby}
\begin{document}
\foreach \number in {1,...,20}{
\begin{tikzpicture}[scale=2]
\draw[orange, very thick] (0,4) to[curve through={(-0.45,2)..(-0.9,0) .. (0.9,0) .. (0.45,2)}] (0,4);
\foreach \place/\el in {{(rnd*0.8,rnd*1.05)/-},{(rnd*0.05,rnd*2.8)/-},{(-rnd*0.5,0.8)/+},{(rnd*0.55,rnd*1.1)/-},{(-rnd*0.2,rnd*1.7)/-},{(rnd*0.4,1.8)/+},{(rnd*0.55,1.5)/+},{(rnd*0.9,rnd*0.9)/+},{(-rnd*0.9,rnd*0.4)/-}}
\node at \place {\ensuremath{\el}};
\end{tikzpicture}
}
\end{document}

Result:

enter image description here

share|improve this answer
4  
+1 for Hobby :) –  Harish Kumar Sep 22 '12 at 9:24
    
That wasn't exactly what I was looking for, but thank you very much for hobby!!! –  Thanos Sep 22 '12 at 9:36
1  
@Thanos: oh.. I've seen the point just after your comments! I've edited my answer to accomplish the right task ;) –  Claudio Fiandrino Sep 22 '12 at 10:08
    
The minus sign should be in math mode, I think. –  stalking is prohibited Sep 22 '12 at 10:37
1  
@ClaudioFiandrino: The - is a sign (negative). Without dollar it is just a dash (hyphen) used in text. I feel $-$ is better. –  Harish Kumar Sep 22 '12 at 11:04

Just for fun with PSTricks.

Still Version:

enter image description here

\documentclass[pstricks,border=3pt]{standalone}
\usepackage{pstricks-add}
\def\N{15}
\begin{document}
\begin{pspicture}[showgrid=false](-2,-2)(2,5)
    \psclip{\psbezier[linestyle=none](0,5)(-6.8,-4.3)(6.8,-4.3)(0,5)}
        \psLoop{\N}{
            \rput(!rand 21 mod 10 div 1 sub rand 51 mod 10 div 1 sub){$+$}
            \rput(!rand 21 mod 10 div 1 sub rand 51 mod 10 div 1 sub){$-$}}%
    \endpsclip
    \psbezier[linecolor=orange](0,5)(-6.8,-4.3)(6.8,-4.3)(0,5)
\end{pspicture}
\end{document}

GIF Version:

enter image description here

\documentclass[pstricks,border=3pt]{standalone}
\usepackage{pstricks-add}
\def\N{15}
\begin{document}
\psLoop{20}{%
\begin{pspicture}[showgrid=false](-2,-2)(2,5)
    \psclip{\psbezier[linestyle=none](0,5)(-6.8,-4.3)(6.8,-4.3)(0,5)}
        \psLoop{\N}{
            \rput(!rand 21 mod 10 div 1 sub rand 51 mod 10 div 1 sub){$+$}
            \rput(!rand 21 mod 10 div 1 sub rand 51 mod 10 div 1 sub){$-$}}%
    \endpsclip
    \psbezier[linecolor=orange](0,5)(-6.8,-4.3)(6.8,-4.3)(0,5)
\end{pspicture}}
\end{document}
share|improve this answer
1  
You are joking!!!This is awsome!!! –  Thanos Sep 22 '12 at 11:16
1  
Holy animated ghost ;). Searching for proper word! –  Harish Kumar Sep 22 '12 at 11:16
    
Thank you if you like it. :-) –  stalking is prohibited Sep 22 '12 at 11:17

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.