18

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

3 Answers 3

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

3
  • Does the plus sign really need in math mode? Sep 22, 2012 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 + ;).
    – user11232
    Sep 22, 2012 at 9:29
  • Thank you very much!!!That was exactly what I was looking for!!!
    – Thanos
    Sep 22, 2012 at 9:37
24

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

13
  • That wasn't exactly what I was looking for, but thank you very much for hobby!!!
    – Thanos
    Sep 22, 2012 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 ;) Sep 22, 2012 at 10:08
  • The minus sign should be in math mode, I think. Sep 22, 2012 at 10:37
  • @GarbageCollector: I think that's a personal taste and Haris's answer already shows the result in math mode. But if you convince me that it is fundamental, I can edit my answer ;) Sep 22, 2012 at 10:46
  • 1
    @ClaudioFiandrino: The - is a sign (negative). Without dollar it is just a dash (hyphen) used in text. I feel $-$ is better.
    – user11232
    Sep 22, 2012 at 11:04
15

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}
2
  • 1
    You are joking!!!This is awsome!!!
    – Thanos
    Sep 22, 2012 at 11:16
  • 1
    Holy animated ghost ;). Searching for proper word!
    – user11232
    Sep 22, 2012 at 11:16

You must log in to answer this question.

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