I would like to be able to draw, using TikZ, a picture as the one below, which consists of:

  • two vertical line segments
  • a wavy line going from the top point of the line segment on the left to the top point of the line segment on the right;
  • a wavy line going from the bottom point of the line segment on the left to the bottom point of the line segment on the right.

Furthermore, I want to be able to fill this region with some color.

enter image description here

I did it using this code:


What bothers me was the need of finding two concrete curves in order to obtain the wavy lines. I think that I should be able to get them using something similar to the rounded corners option of the draw command. Is it possible?

  • Always post compilable code, when possible. Jun 2, 2021 at 20:27

2 Answers 2


I find it easier to do a smooth plot with a couple of coordinates instead of finding control points. -also no need to clip or adjust bounding box.

\documentclass[tikz, border=1mm]{standalone}
 \draw[fill=cyan] plot [smooth, tension=1] coordinates {(0,0) (0.6,0.4) (1.4,-0.4) (2,0)} -- plot [smooth, tension=1] coordinates {(2,-1.5) (0.8,-1.4) (0,-2)} -- cycle;

Filled area


Do it with Bezier curves:
wavy fill with Bezier

        \clip (0,.5) rectangle (2,-2);
        \draw[fill=cyan] (0,0) .. controls ++(1,1.5) and ++(-1,-1.5).. (2,0) -- (2,-1.5) .. controls ++(-1,.2) and ++(.5,.75) .. (0,-2) --cycle;

EDIT: a bit of explanation

While you can look for what Bezier curves are (there are an incredible amount of example on TeX-SE and elsewhere, and of course, you can find them in the manual), here are some explanations:
Pierre Bézier was a French engineer who worked for Renault cars and created these parametrical curves.
In TikZ, you can draw cubic Bezier curves, which allow you to use a start point, an end point, and two other points that conduct the curve. There's some magical maths in here ;) but let's see what it gives graphically:

Bezier points

    \begin{tikzpicture}[lin/.style={red,line width=0.1pt},dot/.style={circle,inner sep=0.5pt,fill=red}]
            (0,0) .. controls ++(1,1.5)
            and ++(-1,-1.5).. (2,0) --

            (2,-1.5) .. controls ++(-1,.2) 
            and ++(.5,.75) .. (0,-2) 


        \draw[lin] (0,0) --++ (1,1.5) node[dot]{};
        \draw[lin] (2,0) --++ (-1,-1.5) node[dot]{};
        \draw[lin] (2,-1.5) --++ (-1,.2) node[dot]{};
        \draw[lin] (0,-2) --++ (.5,.75) node[dot]{};


Here in the code, I added what you need to understand (a bit) how it works. This is the same that you do when using softwares like Illustrator (SVG files).

  • I know nothing about Bezier curves (in TikZ), but this is just what I wanted. Thank you. Jun 2, 2021 at 18:12
  • @JoséCarlosSantos I edited my answer to give some explanations (you may find more on the Internet if you're interested)
    – SebGlav
    Jun 2, 2021 at 19:06
  • 1
    Thank you, but there was no need. I went straight to the TikZ manual. Jun 2, 2021 at 19:35

You must log in to answer this question.

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