[Tex/LaTex] TikZ: Arbitrary shapes and filling

tikz-pgf

Inspired by the suggestion to use the plot function and and some randomly generated points in

Which package can easily write a graph, as an arbitrary curve or area, just for indication

(the answer from March 15, 2011), I now manage to make arbitrary shapes. However, I would like to fill these with different colors, and I suppose the fill-command in TikZ can be applied – but don't manage to do it.

Does anyone know how this can be done?

The code for the arbitrary shape is

\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm, scale = 0.47]

\pgfmathsetseed{3}
\draw plot [smooth cycle, samples=8,domain={1:8}] (\x*360/8+5*rnd:0.5cm+1cm*rnd) node at (0,0) {};

\end{tikzpicture}

Best Answer

You have to supply the fill options to the \draw command

\begin{tikzpicture}    
\pgfmathsetseed{3}
\draw[fill=blue] plot [smooth cycle, samples=8,domain={1:8}]
     (\x*360/8+5*rnd:0.5cm+1cm*rnd) node at (0,0) {};
\end{tikzpicture}