# How to give multiple axis the same style/options

I would like to pick your brains again on a small issue.

I want to use tikzstyle to describe the style of multiple plots but when I copy and paste the style I use on my plot, I get a compilation error.

Working code :

\documentclass{standalone}
\usepackage{pgfplots}

\begin{document}

\def\T{10}
\def\K{10}

\begin{tikzpicture}
\tikzstyle{Bode}=[]
\tikzstyle{Asymp}=[red,densely dashed,thick=1pt]
\tikzstyle{LieuReel}=[thick=1pt]

\def\FloorW{floor(ln(1/\T)/ln(10))}
\def\CeilW{ceil(ln(1/\T)/ln(10))}
\def\GdbK{20*ln(\K)/ln(10)}

\begin{semilogxaxis}[height=5cm,width=10cm,xlabel=$\omega$,ylabel=$G_{dB}$,grid=both,axis x line=bottom, axis y line = left,ymax=(\GdbK+4),xmax=10^(\CeilW+2.2)]

\end{semilogxaxis}
\end{tikzpicture}

\end{document}

Now, I put the style of my semilogaxis in the tikzstyle{Bode} and type Bode in it instead

\tikzstyle{Bode}=[height=5cm,width=10cm,xlabel=$\omega$,ylabel=$G_{dB}$,grid=both,axis x line=bottom, axis y line = left,ymax=(\GdbK+4),xmax=10^(\CeilW+2.2)]
...
\begin{semilogxaxis}[Bode]

and it gets me this error:

! Package pgfkeys Error: I do not know the key '/tikz/height', to which you passed '5cm', and I am going to ignore it. Perhaps you misspelled it.See the pgfkeys package documentation for explanation.Type H <return> for immediate help.... \end{semilogxaxis}

Can you help me ?

\tikzstyle{foo}=[..] or the replacement \tikzset{foo/.style={..}} looks in the /tikz family of keys, but width, height and the other axis parameters belong to the /pgfplots family, so you get an error that /tikz/width is unknown.

Instead you can use \pgfplotsset{foo/.style={..}}, then the keys are assumed to be in the /pgfplots family.

By the way, in general it would be better to use \newcommand instead of \def, because then you won't accidentally overwrite existing macros.

\documentclass{standalone}
\usepackage{pgfplots}

\begin{document}

\newcommand\T{10}
\newcommand\K{10}

\begin{tikzpicture}[
Asymp/.style={red,densely dashed,thick=1pt},
LieuReel/.style={thick=1pt}
]

\newcommand\FloorW{floor(ln(1/\T)/ln(10))}
\newcommand\CeilW{ceil(ln(1/\T)/ln(10))}
\newcommand\GdbK{20*ln(\K)/ln(10)}
\pgfplotsset{
bode/.style={
height=5cm,
width=10cm,
xlabel=$\omega$,
ylabel=$G_{dB}$,
grid=both,
axis x line=bottom,
axis y line = left,
ymax=(\GdbK+4),
xmax=10^(\CeilW+2.2)}
}
\begin{semilogxaxis}[bode]