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.

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}
share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

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}
share|improve this answer
add comment

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.