31

I have this little cloud shape that I want to use in my system diagram figures.

\usetikzlibrary{shapes}

\begin{tikzpicture}
\node [cloud, draw,cloud puffs=10,cloud puff arc=120, aspect=2, inner ysep=1em] {};
\end{tikzpicture}

It looks like this:

symmetric cloud

The problem, though, is that the cloud is too symmetrical. I want one side to be 'shorter'. Something like this (minus the arrow, text and drop shadow, of course):

unsymmetric cloud

Can't find anything in the manual or online. Any hints?

10

It's not a very good answer but I don't have enough time to do a new shape and you can find a lot of examples to do a new shape (batman or other shapes) from this answer.

I made manually a cloud and I place the text inside. You can make a macro to draw the cloud and to place the text at the same time.

You can use the node (cloud) to place arrows etc.

What you can do:

  • new shape: asym cloud
  • or a macro to draw the cloud and to place the text

\documentclass[11pt]{scrartcl}
\usepackage{tikz}
\newcommand{\asymcloud}[2][.1]{%
\begin{scope}[#2]
\pgftransformscale{#1}%    
\pgfpathmoveto{\pgfpoint{261 pt}{115 pt}} 
  \pgfpathcurveto{\pgfqpoint{70 pt}{107 pt}}
                 {\pgfqpoint{137 pt}{291 pt}}
                 {\pgfqpoint{260 pt}{273 pt}} 
  \pgfpathcurveto{\pgfqpoint{78 pt}{382 pt}}
                 {\pgfqpoint{381 pt}{445 pt}}
                 {\pgfqpoint{412 pt}{410 pt}}
  \pgfpathcurveto{\pgfqpoint{577 pt}{587 pt}}
                 {\pgfqpoint{698 pt}{488 pt}}
                 {\pgfqpoint{685 pt}{366 pt}}
  \pgfpathcurveto{\pgfqpoint{840 pt}{192 pt}}
                 {\pgfqpoint{610 pt}{157 pt}}
                 {\pgfqpoint{610 pt}{157 pt}}
  \pgfpathcurveto{\pgfqpoint{531 pt}{39 pt}}
                 {\pgfqpoint{298 pt}{51 pt}}
                 {\pgfqpoint{261 pt}{115 pt}}
\pgfusepath{fill,stroke}         
\end{scope}}    
\begin{document}
 \begin{tikzpicture}
 \draw (0,0) rectangle (15,10) ;
 \node (cloud) at (8,7) {\tikz \asymcloud{fill=gray!20,thick};};
 \node at (4,6) {\tikz[cm={-1,0,0,1,(0,0)}]\asymcloud[.15]{fill=gray!20,thick};}; 
 \node at (8,7) {Net};
\end{tikzpicture}

\end{document}  

enter image description here

31

I had to use a cloud shape in one of my figures in an university lecture, and I came up with this solution:

Asymmetric cloud

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[magyar]{babel}

\usepackage{tikz}
\usetikzlibrary{positioning, shapes}

\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}


\begin{document}

\begin{tikzpicture}[font=\large\sffamily]

\node[cloud, cloud puffs=15.7, cloud ignores aspect, minimum width=5cm, minimum height=2cm, align=center, draw] (cloud) at (0cm, 0cm) {Cloud};

\end{tikzpicture}

\end{document}

The key is to use the cloud ignores aspect keyword, and control width and height with minimum width and minimum height keywords. Asymmetry can be achieved specifying a float number for cloud puffs.

Not perfect, but this is what I use now.

3

Obviously the asymmetric cloud can even be simply draw. An exact copy of the cloud that you want is:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}

\draw (-1.6,-0.7) .. controls (-2.3,-1.1)
and (-2.7,0.3) .. (-1.7,0.3) .. controls (-1.6,0.7)
and (-1.2,0.9) .. (-0.8,0.7) .. controls (-0.5,1.5)
and (0.6,1.3) .. (0.7,0.5) .. controls (1.5,0.4)
and (1.2,-1) .. (0.4,-0.6) .. controls (0.2,-1)
and (-0.2,-1) .. (-0.5,-0.7) .. controls (-0.9,-1)
and (-1.3,-1) .. cycle;

\end{tikzpicture}   
\end{document}

enter image description here

Edit.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand{\AsymCloud}[3]{
\begin{scope}[shift={#1},scale=#3]
\draw (-1.6,-0.7) .. controls (-2.3,-1.1)
and (-2.7,0.3) .. (-1.7,0.3)coordinate(asy1) .. controls (-1.6,0.7)
and (-1.2,0.9) .. (-0.8,0.7) .. controls (-0.5,1.5)
and (0.6,1.3) .. (0.7,0.5) .. controls (1.5,0.4)
and (1.2,-1) .. (0.4,-0.6)coordinate(asy2) .. controls (0.2,-1)
and (-0.2,-1) .. (-0.5,-0.7) .. controls (-0.9,-1)
and (-1.3,-1) .. cycle;
\node at ($(asy1)!0.5!(asy2)$) {#2};
\end{scope}
}
\begin{document}
\pagestyle{empty}
\begin{tikzpicture}
%\AsymCloud{coordinate}{text}{scale factor}
\AsymCloud{(0,0)}{text}{1}
\AsymCloud{(0,-6)}{very very very very very very long text}{2}
\end{tikzpicture} 
\end{document}

enter image description here

  • 2
    How can we use it as a template and draw the clouds of different sizes? – Jitendra Sep 16 '18 at 16:26
  • @Jitendra for change the size and shift the cloud you must use \draw[scale=2,shift={(1,0)}] ... for example. You can create a little macro with \newcommand. – vi pa Sep 18 '18 at 14:13
  • Thank you @vi pa. How can be make is a node using \node? Also, instead of absolute points, can we make it relative points? – Jitendra May 3 at 12:32
  • @Jitendra Look at the edit. – vi pa May 7 at 12:41
  • Thank you @vi pa – Jitendra May 12 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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