# Pgfplot - Easiest way to draw ski slope

I want to draw the following figure using pgfplot. I know basic geometry in latex but the curve part of the figure is difficult to understand.

Any help would be appreciated.

EDIT 1: Sorry for not adding my starting code.

\begin{tikzpicture}[thick]
\coordinate (W) at (1,4.5);
\coordinate (X) at (0, 0);
\coordinate (Y) at (0, 3);
\coordinate (Z) at (7, 0);
\coordinate (A) at (7,0.5);
\coordinate (B) at (8,1.5);
\coordinate (C) at (8,2);
\draw (X) -- node[pos = 0.5, left, font=\footnotesize] {5.0 m} (Y) -- (W);
\draw (X) -- node[pos = 0.5, below, font=\footnotesize] {74 m} (Z);
\draw (Z) -- (A) -- (C) -- (B) -- (Z);

\draw (10,1) node {NOT TO SCALE};
\end{tikzpicture}


Resulting figure:

EDIT 2: Based on @marmot answer, I am able to draw the figure (plus labeling) as shown below.

.

QUESTION: The only problem left is how to mark the shaded part. Since we have an equation at one side and lines on the other three sides. Any help would be appreciated.

EDIT 3: I was able to do the filling using this command:

\fill [pattern=north west lines, domain=0:500,smooth,variable=\x]
(X) -- plot ({\x/71.5},{3-\x/222-0.4*sin(\x)}) -- (Z);


The final code looks like this:

\begin{tikzpicture}[thick]
\coordinate (W) at (1,4.5);
\coordinate (X) at (0, 0);
\coordinate (Y) at (0, 3);
\coordinate (Z) at (7, 0);
\coordinate (A) at (7,0.5);
\coordinate (B) at (8,1.5);
\coordinate (C) at (8,2);
\draw (X) -- node[pos = 0.5, left, font=\footnotesize] {5.0 m} (Y) -- (W);
\draw (X) -- (Z);
\draw (Z) -- (A) -- (C) -- (B) -- node[pos = 0.5, right, font=\footnotesize] {28 m}(Z);
\coordinate (P) at (1.75,0);
\coordinate (Q) at (1.75,2.1);
\coordinate (R) at (3.5,0);
\coordinate (S) at (3.5,2.25);
\coordinate (T) at (5.25,0);
\coordinate (U) at (5.25,1.2);
\draw (P) -- node[pos = 0.5, left, font=\footnotesize] {3.5 m} (Q);
\draw (R)  -- node[pos = 0.5, left, font=\footnotesize] {4.0 m} (S);
\draw (T) -- node[pos = 0.5, left, font=\footnotesize] {2.3 m} (U);
\tkzMarkRightAngle[size=0.2](Z,P,Q);
\tkzMarkRightAngle[size=0.2](Z,R,S);
\tkzMarkRightAngle[size=0.2](Z,T,U);
\draw [dashed] (1.75,2.1) -- (2.75,3.6);
\draw [dashed] (3.5,2.25) -- (4.5,3.75);
\draw [dashed] (5.25,1.2) -- (6.25,2.7);
\draw[domain=0:500,smooth,variable=\x] plot ({\x/71.5},{3-\x/222-0.4*sin(\x)});
\draw[domain=0:500,smooth,variable=\x] plot ({\x/71.5+1},{4.5-\x/222-0.4*sin(\x)});
\fill [pattern=north west lines, domain=0:500,smooth,variable=\x]
(X) -- plot ({\x/71.5},{3-\x/222-0.4*sin(\x)}) -- (Z);
\draw[latex-latex] (0,-1) -- node [fill=white, font=\footnotesize] {74 m}(7,-1);
\draw[latex-latex] (8.2,1.5) -- (8.2,2);
\draw (9,1.75) node {70 cm};
\draw (8,3) node {NOT TO SCALE};
\end{tikzpicture}


Lastly,

• Why do my north-west lines are so 'broken'?
• If there a more neat way to write this code, please do let me know.
• Please add a minimal working example (MWE) of what you've tried so far. Jan 12, 2018 at 18:00
• Using your code, I get something where the NW lines are not "broken". I suspect that your output has to do with the preamble of your document, which you do not reveal. As for simplicity, the code is pretty good since it is rather easy to understand it and to see which command has what effect. The least aesthetic feature is perhaps that you name some coordinates but on other occasions you spell them out. I am actually not sure how much you benefit from naming the coordinates here.
– user121799
Jan 13, 2018 at 18:01

Just to give you a starting point...

\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{width=12cm,compat=1.15,view={10}{10},
/pgfplots/colormap={gray}{rgb255=(155,155,155) rgb255=(225,225,225)}
}
\begin{document}
\begin{tikzpicture}[declare function={f(\x,\y)=5-\x-0.8*sin(100*\x);}]
\end{axis}
\end{tikzpicture}
\end{document}


EDIT: Thanks for your MWE! Here is a proposal for the slope.

\documentclass{article}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}[thick]
\coordinate (W) at (1,4.5);
\coordinate (X) at (0, 0);
\coordinate (Y) at (0, 3);
\coordinate (Z) at (7, 0);
\coordinate (A) at (7,0.5);
\coordinate (B) at (8,1.5);
\coordinate (C) at (8,2);
\draw (X) -- node[pos = 0.5, left, font=\footnotesize] {5.0 m} (Y) -- (W);
\draw (X) -- (Z);
\draw (Z) -- (A) -- (C) -- (B) -- node[pos = 0.5, right, font=\footnotesize] {28 m}(Z);
\coordinate (P) at (1.75,0);
\coordinate (Q) at (1.75,2.1);
\coordinate (R) at (3.5,0);
\coordinate (S) at (3.5,2.25);
\coordinate (T) at (5.25,0);
\coordinate (U) at (5.25,1.2);
\draw (P) -- node[pos = 0.5, left, font=\footnotesize] {3.5 m} (Q);
\draw (R)  -- node[pos = 0.5, left, font=\footnotesize] {4.0 m} (S);
\draw (T) -- node[pos = 0.5, left, font=\footnotesize] {2.3 m} (U);
\tkzMarkRightAngle[size=0.2](Z,P,Q);
\tkzMarkRightAngle[size=0.2](Z,R,S);
\tkzMarkRightAngle[size=0.2](Z,T,U);
\draw [dashed] (1.75,2.1) -- (2.75,3.6);
\draw [dashed] (3.5,2.25) -- (4.5,3.75);
\draw [dashed] (5.25,1.2) -- (6.25,2.7);
\draw[domain=0:500,smooth,variable=\x] plot ({\x/71.5},{3-\x/222-0.4*sin(\x)});
\draw[domain=0:500,smooth,variable=\x] plot ({\x/71.5+1},{4.5-\x/222-0.4*sin(\x)});
\fill [pattern=north west lines, domain=0:500,smooth,variable=\x]
(X) -- plot ({\x/71.5},{3-\x/222-0.4*sin(\x)}) -- (Z);
\draw[latex-latex] (0,-1) -- node [fill=white, font=\footnotesize] {74 m}(7,-1);
\draw[latex-latex] (8.2,1.5) -- (8.2,2);
\draw (9,1.75) node {70 cm};
\draw (8,3) node {NOT TO SCALE};
\end{tikzpicture}
\end{document}


• thank you so much. I am wondering how did you calculate the equation? Jan 13, 2018 at 3:40
• and how to shade the cross-sectional part. Jan 13, 2018 at 4:19
• @urwaCFC Done. Please notice that it is not usual to modify the question in the way you did.
– user121799
Jan 13, 2018 at 4:28