5

I tried both

    \documentclass{standalone}
\usepackage{tikz,pgfplots}

\tikzset{axeseul/.style={%
/pgfplots/axis x line align=center, % rien en y     
/pgfplots/axis y line align=none,   % sans axe y
%ymin=0,ymax=1
red}}

\begin{document}
\begin{tikzpicture}
\begin{axis}[style=axeseul,ymin=0,ymax=1] 
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

or

    \documentclass{standalone}
\usepackage{tikz,pgfplots}

\tikzstyle{axeseul}=[%
    /pgfplots/axis x line align=center, % rien en y     
    /pgfplots/axis y line align=none,   % sans axe y
    %ymin=0,ymax=1
    red]

\begin{document}
\begin{tikzpicture}
\begin{axis}[style=axeseul,ymin=0,ymax=1] 
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

Both give me red axis but no center and no none ... Where is the mystake ?

6

As percusse mentions in his comment, the problem with your settings is that tikzset sets the key /tikz/pgfplots/... so nothing is read and executed. You should use \pgfplotsset:

\documentclass{standalone}
\usepackage{pgfplots}

\pgfplotsset{axeseul/.style={%
axis x line =center,     
axis y line =none,
red}}

\begin{document}
\begin{tikzpicture}
\begin{axis}[axeseul,ymin=0,ymax=1]
\end{axis}
\end{tikzpicture}

\end{document}

enter image description here

  • Thank's it works fine, but I want ymin=0 and ymax=1 at once in the axeseul style. Is it possible ? I tried to add them, but it does nothing. – Tarass Feb 7 '14 at 17:49
  • @Tarass you can add those options: \pgfplotsset{axeseul/.style={% axis x line =center, axis y line =none, ymin=0,ymax=1, red}} and remove them from the axis environment if the styles has already been applied. – Gonzalo Medina Feb 7 '14 at 17:52
  • Ok, I forgot to add : compat=newest, it work now. Thank you. – Tarass Feb 7 '14 at 19:02

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.