0

I am rather new to Tikz, and I could not find this anywhere online. How would one draw this rather complex figure meant to show a wave?

enter image description here

I only know how to create points and connect them with straight lines. I do not know how to make a curved line like the wave above shows, I do not know how to put labels in all the places shown in the figure and how to rotate them like with the y1 and y2, I do not know how to fill the area in blue, and I do not know how to color the top arch green. I really have no idea where to get started on this, nor do I know if Tikz can even produce such a figure. I thank all helpers and would appreciate all help on this.

Edit: here is what I have so far and also where I am stuck

\begin{tikzpicture}[scale=2.25]
\coordinate (A) at (0cm,2cm);
\coordinate (B) at (0cm,0cm);
\coordinate (C) at (2cm,0cm);
\coordinate (D) at (2cm,2cm);
\draw (A) -- (B) -- (C) -- (D);

\end{tikzpicture}
9
  • 2
    Please show us what you try so far. (in form (of Minimal (not) Working Example).
    – Zarko
    Apr 13, 2022 at 3:36
  • 2
    You may want to read the TikZ manual if you haven't.
    – user202729
    Apr 13, 2022 at 3:41
  • 2
    Searching for existing posts e.g. tex.stackexchange.com/questions/115554/… is okay too, but generally they tend to be quite complex, so stick with the manual and/or look up what each option in the answer does with the manual and pick only the useful ones may be easier
    – user202729
    Apr 13, 2022 at 3:43
  • 1
    For the fill there's e.g. tikz pgf - Filling area under a function - TeX - LaTeX Stack Exchange
    – user202729
    Apr 13, 2022 at 3:43
  • 1
    You can add text to the figure right? (although you may have to manually specify the coordinate instead of let it automatically computed which might look less neat)
    – user202729
    Apr 13, 2022 at 3:44

1 Answer 1

4

You can make curves with Bezier curves and you can add labels when you use nodes. I only started learning Tikz yesterday myself, but I made the following, so I'm sure you'll also be able to catch on quick;

\documentclass{article}

\usepackage{tikz}
\definecolor{water}{rgb}{0,1,1}

\begin{document}

\begin{tikzpicture}
\draw[fill=water] (0,1) .. controls (1,1.5) and (2,1.5) .. (3,1) -- (3,0) -- (0,0) -- (0,1) 
node at (1.5,0.8)[]{g(x)} 
node at (1.5,1.6)[]{f(x)};
\draw (0,0) -- (0,2);
\draw (3,0) -- (3,2);
\end{tikzpicture}

\end{document}

Which generates:

enter image description here

EDIT: To change the colour of just the curve, I'd define the curve in a separate \draw command.

\begin{tikzpicture}
\draw[fill=water, color=water] (0,1) .. controls (1,1.5) and (2,1.5) .. (3,1) -- (3,0) -- (0,0) -- (0,1) 
node at (1.5,0.8)[black] {g(x)} 
node at (1.5,1.6)[black]{f(x)};
\draw[color=green] (0,1) .. controls (1,1.5) and (2,1.5) .. (3,1);
\draw[black] (3,0) -- (0,0) -- (0,2);
\draw (3,0) -- (3,2);
\end{tikzpicture}
4
  • thank you so much
    – user209867
    Apr 13, 2022 at 3:48
  • 1
    @kroner No probs. If this is the solution you were looking for then click the check mark to indicate for future reference. I also recommend you edit the question name to make it more specific
    – arara
    Apr 13, 2022 at 3:51
  • how do I change the color of the arc?
    – user209867
    Apr 13, 2022 at 4:16
  • 1
    @kroner see edit
    – arara
    Apr 13, 2022 at 4:39

You must log in to answer this question.