Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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 ?

share|improve this question

1 Answer 1

up vote 6 down vote accepted

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

share|improve this answer
    
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 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 at 17:52
    
Ok, I forgot to add : compat=newest, it work now. Thank you. –  Tarass Feb 7 at 19:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.