Another example, based on a request for drafting a practical load curve of electricity, example that requires some style manipulations that are not very concentrated in the examples of the books, so it is a compilation of the manuals taken from here and there.
RESULT:

MWE:
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
\usepackage{filecontents}
\pgfplotsset{compat=1.14}
\begin{document}
\begin{filecontents}{data01.dat}
0 5
1 8
2 6
3 7
4 6
5 7
6 10
7 11
8 14
9 15
10 12
11 11
12 4
13 5
14 10
15 11
16 13
17 14
18 13
19 20
20 24
21 18
22 19
23 15
24 5
\end{filecontents}
\begin{tikzpicture}[
%Environment Cfg.
font=\bfseries\sffamily,
]
\begin{axis}[
width=12cm,
height=8cm,
at={(0,0)},
ymin=0,
ymax=30,
xmin=0,
xmax=30,
grid=both,
minor tick num =5,
minor tick style={draw=none},
minor grid style={thin,color=black!10},
major grid style={thin,color=black!10},
ylabel={L\\O\\A\\D\\[5pt] kW.},
xlabel=Time in Hours,
tick align=outside,
axis x line*=middle,
axis y line*=none,
xtick={0,5,...,30},
ytick={0,5,...,30},
xlabel style={color=blue!50!cyan},
ylabel style={align=center,rotate=-90,color=blue!50!cyan},
x tick label style={
/pgf/number format/assume math mode, font=\sf\scriptsize},
y tick label style={
/pgf/number format/assume math mode, font=\sf\scriptsize},
]
\addplot[color=blue!50!cyan,smooth,tension=0.7,very thick] table [x index=0,y index=1,col sep=space] {data01.dat};
\addplot[color=cyan!50!lime,very thick] coordinates{(0,5)(25,5)};
\addplot[color=orange,very thick] coordinates{(0,11)(25,11)};
\addplot[color=red!80!orange,very thick] coordinates{(19,24.2)(23,24.2)};
\node[text=cyan!50!lime,fill=white,align=center,anchor=west,scale=0.8,inner sep=5pt] at (24.5,5){Base\\ Load};
\node[color=orange,fill=white,align=center,anchor=west,scale=0.8,inner sep=5pt] at (24.5,11){Average\\ Load};
\node[color=red!80!orange,fill=white,align=center,anchor=west,scale=0.8,inner sep=5pt] at (21.2,24.2){Maxium\\ Load};
\end{axis}
\end{tikzpicture}
\end{document}
pgfplotstable
)csvsimple
package. Can you make it work if you use it outside the TikZ picture?\begin{tikzpicture} \csvreader[head to column names]{data.csv}{}{% \draw (\a,\b) node {$\times$}; } \end{tikzpicture}
will work but I need to draw segments, not points. So I need a way to remember the previous point like in thecsvsimple
examples (not hard, but I don't know LaTeX that well).