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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Simple question:

Is it possible to fill the following shape:

\draw [decorate,decoration = {snake,amplitude =.4mm, segment length = 5mm}] (0,0)--(10,0);
\draw (0,0)..controls(0,-1)and(10,-1)..(10,0);

enter image description here

Apologies if this question is rather simplistic.

share|improve this question
up vote 12 down vote accepted

The typical approach to fill complex shapes is trying to envision our area as the intersection of two simpler closed paths, and then fill one of those paths areas while clipping to the another.

For example, your region can be seen as the intersection of the following two paths:

\draw  (0,0) .. controls +(0,-1) and +(0,-1)..(10,0) -- (10,1) -- (0,1) --cycle ;
\draw [decorate,decoration = {snake,amplitude =.4mm, segment length = 5mm}] (0,0)--(10,0) -- (10,-1) -- (0,-1) -- cycle;


So the idea is to fill the "wavy rectangle", and clipping the result to the "curved bottom rectangle". The part of the code which does this trick has to be enclosed in a scope to prevent the clipping to be applied to the whole figure (in case that it is part of something bigger).

The following code implements this idea:

\clip  (0,0) .. controls +(0,-1) and +(0,-1)..(10,0) -- (10,1) -- (0,1) --cycle ;
\draw  [fill=orange!50, decorate,decoration = {snake,amplitude =.4mm, segment length = 5mm}] (0,0)--(10,0) -- (10,-1) -- (0,-1) --cycle ;
\draw (0,0) ..controls +(0,-1)and +(0,-1)..(10,0);


share|improve this answer
I would enclose the \clip path in the pgfinterruptboundingbox environment. Otherwise you have nearly 1cm more height in the resulting box containing the TikZ picture. Of course, this doesn’t matter if you add more stuff above the wavy line. – Qrrbrbirlbel Mar 6 '13 at 21:07

In this simple case, you can use just one path that gets filled.

A few notes:

  • The decoration is activated with decorate {<part of path that shall be decorated>}, so we put (0,0) -- (10,0) in it.

  • The control syntax understands relative coordinates which I introduced because I needed to switch the direction of the curve (it now goes from (10, 0) to (0, 0)).

  • Instead of the .. controls (<c1>) and (<c2>) .. syntax you can also use curve to paths. In this case with the angles set to 270 and a distance of 1cm:

    to[distance=1cm, out=270, in = 270] (water-start)
  • The -- cycle makes a nice line at the start.

  • I have also introduced two coordinates:

    • water-start and
    • water-end.

    As water-start is used twice in the path, you now only need to change the \coordinate line, if you want to start elsewhere and not two values in a path.


\coordinate (water-start) at (0,0);
\coordinate (water-end) at (10,0);
        amplitude =.4mm,
        segment length = 5mm
] decorate {(water-start) -- (water-end)}
%   .. controls +(0,-1) and +(0,-1) .. (water-start) % this is the same
   to[distance=1cm, out=270, in = 270] (water-start) % as this
   -- cycle


enter image description here

share|improve this answer

As stated in the TIKZ/PGF-3.0 manual in section 24.2 Decorating a Subpath Using the Decorate Path Command this can be achieved with the decorate path command.

\draw[fill=orange!50] (0,0) -- (0,1) -- (1,1) decorate[decoration=snake] {-- (1,0)} -- cycle;
share|improve this answer

enter image description here

share|improve this answer

Your Answer


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.