2

I would like to make a few alterations to the following figure:

\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{snakes,arrows}

\begin{document}
\begin{tikzpicture}
% draw the ground
\draw (0,0) -- (8.5,0) .. controls (8.5,-1) and (10,-1).. (11,-1) -- (14,-1);
% draw lake surface
\draw [snake = snake,segment amplitude =.4mm, segment length = 5mm] (8.5,0) -- (14,0);
% draw the wind velocity field
\draw[very thick,gray](12,0)--(12,5);
\draw (12,0)..controls(12.5,2) and(14,3) ..(14,5);% draw profile
\end{tikzpicture}
\end{document}

enter image description here

From this figure I would like to add horizontal arrow lines from the straight vertical line to the curved line. My attempt:

\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{snakes,arrows}

\begin{document}
\begin{tikzpicture}
% draw the ground
\draw (0,0) -- (8.5,0) .. controls (8.5,-1) and (10,-1).. (11,-1) -- (14,-1);
% draw lake surface
\draw [snake = snake,segment amplitude =.4mm, segment length = 5mm] (8.5,0) -- (14,0);
% draw the wind velocity field
\draw[very thick,gray](12,0)--(12,5);
\draw (12,0)..controls(12.5,2) and(14,3) ..(14,5);% draw profile
\foreach \y in {2,3,5}
\foreach \x in {12.5,14,14}{
\draw[=>stealth,->](12,\y)--(\x,\y);
}
\end{tikzpicture}
\end{document}

enter image description here

which is obviously incorrect, but I cant seem to solve this. Also, how could I make the horizontal lines be drawn 5 time evenly spaced vertically?

2

The snakes library is deprecated, use the decorations.pathmorphing library instead.

To find the right points on the curved line I have used the intersections library.
The curved line is named curve.

In a loop that iterates over \y from 1 to 5 a path is named horizontal that goes from (12, \y) to (15, \y) (so that it crosses the curved path). The intersection of curve and horizontal is named intersection-1 and is used in a drawn path.

Code

\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing,arrows,intersections}

\begin{document}
\begin{tikzpicture}
% draw the ground
\draw (0,0) -- (8.5,0) .. controls (8.5,-1) and (10,-1).. (11,-1) -- (14,-1);
% draw lake surface
\draw [decorate, decoration={snake,amplitude =.4mm, segment length = 5mm}] (8.5,0) -- (14,0);
% draw the wind velocity field
\draw[very thick,gray](12,0)--(12,5);
\draw[name path=curve] (12,0)..controls(12.5,2) and(14,3) ..(14,5);% draw profile
\foreach \y in {1,...,5}{
    \path[name path=horizontal] (12,\y) -- + (3,0);
    \draw[-stealth,name intersections={of=curve and horizontal}] (12,\y) -- (intersection-1);
}
\end{tikzpicture}
\end{document}

Output

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.