I'm starting to use TiKz to create graphics and I would like the opinion of some more advanced users to comment on my code. Anything from tips to advices or things that could be done in a different and better way will be apreciated.
Here is my code:
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{siunitx}
\usepackage{tikz, pgfplots}
\usepackage[european]{circuitikz}
\usepackage{float}
\pgfplotsset{compat=1.12}
\usetikzlibrary{calc}
\newcommand{\subb}[1]{_{\mathrm{#1}}}
\begin{document}
\begin{figure}[H]
\centering
\begin{circuitikz}
\draw
(0,0) to[battery,l_=$V\subb{in}$] ++(0,-4) coordinate (v)
% (0,0) to[short]++(1,0)
(0,0) to[inductor, l^=$L$,-*,v_=$v\subb L$,i=$i\subb L$] ++(3,0) coordinate (s1)
([xshift=15pt, yshift=-15pt]s1) coordinate (son)
(son) to[short,o-] (son|-v)
to[short] (v)
([xshift=22pt]s1) coordinate (soff)
(soff) to[short,o-*]++(2,0) coordinate (c)
to[C,l_=$C$,i>_=$i\subb C$] (c|-v) coordinate (cc)
to[short,*-*] (cc-|son)
(c) to[short] ++ (2,0) coordinate (l)
to[R,l_=$R\subb L$,v^=$V\subb{out}$,i>_=$i\subb{out}$] (l|-cc)
to[short] (cc);
\draw [very thick] (s1)--++(19pt,-8pt);
\node[anchor = north east] at (son) {$T\subb{ON}$};
\node[anchor = south] at (soff) {$T\subb{OFF}$};
\end{circuitikz}
\caption{Boost converter}
\label{circ:boost_diagrama}
\end{figure}
\begin{figure}[H]
\centering
\begin{tikzpicture}
\def\ton{1}
\def\toff{2}
\def\von{2}
\def\voff{-3}
\def\ilmax{3}
\def\ilmin{1.4}
\begin{axis}
[
xlabel = $t$,
axis x line=center,
axis y line=center,
x label style = {anchor=north},
y label style = {anchor=east},
no markers,
xmin = -0.3, xmax = \toff + 0.7,
ymin = \voff - 0.5, ymax = \von + 2,
xtick = {0,\ton,\toff},
xticklabels = {0,{$T\subb{ON}$},{$T\subb{OFF}$}},
x tick label style = {anchor=north east},
ytick = {\von,\voff,\ilmax,\ilmin},
yticklabels = {{\color{blue}$V\subb{in}$},{\color{blue}$V\subb{in}-V\subb{out}$},{\color{red}$I\subb{L\subb{max}}$},{\color{red}$I\subb{L\subb{max}}$}}
]
\addplot [blue, thick] coordinates
{
(0,\von)
(\ton,\von)
(\ton,\voff)
(\toff,\voff)
(\toff,\von)
(\toff+0.5,\von)
};
\draw [dashed] (axis cs:\ton, \voff) -- (axis cs:0, \voff);
\addplot [red, thick] coordinates
{
(0,\ilmin)
(\ton,\ilmax)
(\toff,\ilmin)
(\toff+0.5,{\ilmin+(\ilmax-\ilmin)*0.5})
};
\draw [dashed] (axis cs:\ton,\ilmax) -- (axis cs:0, \ilmax);
\draw [dashed] (axis cs:\toff,\ilmin) -- (axis cs:0, \ilmin);
\legend{$v\subb L$,$i\subb L$}
\end{axis}
\end{tikzpicture}
\caption{Voltage and current in across the inductor}
\label{graf:tensio_corrent_L}
\end{figure}
\end{document}
As you can see the resoolt looks fine but I would like to receive some comments about my code.
Thanks!

pgfplotstablewhich loads pgfplots, tikz and tikz also loads graphicx and so on which reduces the clutter in my preamble. It's not always the best idea (packages might clash due to option differences) but most of the cases there are no problems. – percusse Jun 20 '17 at 11:31compatlevel higher than1.11you don't need to precede the TikZ coordinates byaxis cs:. Thus, e.g.\draw [dashed] (\ton, \voff) -- (0, \voff);would yield the same result as withaxis cs:. – Stefan Pinnow Jun 20 '17 at 11:43axis cs:be removed from anywhere? Or is there some place where its still mandatory? – jagjordi Jun 20 '17 at 11:46compat=1.11or higher). Thenaxis cs:is the default used coordinate system (insideaxisenvironments and the like). – Stefan Pinnow Jun 20 '17 at 11:55