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.

By default in PGFplots, when axes are only shown in the bottom left corner, arrows appear at the end of the ends of axes lines. How can I change the defaults so these arrows do not appear?

Edit: Example code that produces plots with arrows at the tips of the axes lines

\documentclass{article}
\usepackage{pgfplots}
\begin{document}

\begin{tikzpicture}
   \begin{axis}[axis x line=middle,axis y line=middle]
      \addplot {x^3};
   \end{axis} 
\end{tikzpicture}
\end{document}
share|improve this question
2  
Can you please add to your question a complete and minimal example code illustrating the behaviour mentioned? –  Gonzalo Medina Jul 19 '12 at 22:16
add comment

3 Answers

up vote 5 down vote accepted

You can use

\pgfplotsset{ every non boxed x axis/.append style={x axis line style=-},
     every non boxed y axis/.append style={y axis line style=-}}

A complete MWE follows

\documentclass{article}
\usepackage{pgfplots}       

\pgfplotsset{ every non boxed x axis/.append style={x axis line style=-},
     every non boxed y axis/.append style={y axis line style=-}}

\begin{document}

      \begin{tikzpicture}
        \begin{axis}
          \addplot expression{x};
        \end{axis}
      \end{tikzpicture}

\end{document}
share|improve this answer
    
I don't see difference in the output with or without the \pgfplotsset. –  Peter Grill Jul 20 '12 at 3:28
1  
Your code won't produce the expected result. –  Gonzalo Medina Jul 20 '12 at 6:25
    
I don't see a difference either, but I'm hoping the answer looks something like this. –  Jeff Jul 20 '12 at 6:42
1  
@Jake has a correction to your pgfplotsset command that makes it work for me. Could you correct your answer? –  Jeff Jul 20 '12 at 7:28
1  
@Jeff the moral of the story is: post a MWE :) I would have been able to fix the code myself if I had seen what you were working with –  cmhughes Jul 20 '12 at 21:27
show 2 more comments

There are "starred" versions of the axis x line and axis lines keys that switch off the arrow tips.

\documentclass{article}
\usepackage{pgfplots}
\begin{document}

\begin{tikzpicture}
   \begin{axis}[axis lines*=middle]
      \addplot {x^3};
   \end{axis} 
\end{tikzpicture}
\end{document}

share|improve this answer
add comment

You can use the axis line style option; an example showing the axis with and without the arrows:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
   \begin{axis}[axis x line=middle,axis y line=middle]
      \addplot {x^3};
   \end{axis} 
\end{tikzpicture}

\begin{tikzpicture}
   \begin{axis}[axis x line=middle,axis y line=middle,axis line style={-}]
      \addplot {x^3};
   \end{axis} 
\end{tikzpicture}

\end{document}

enter image description here

As Jake mentioned in a comment, to globally disable the arrow tips, you can use

\pgfplotsset{ every non boxed x axis/.append style={x axis line style=-} }
share|improve this answer
    
This example works great, but is there a way to make this the default 'axis line style' for every plot? I'm generating many figures using matlab2tikz and would like to set this globally in the TeX file if possible. –  Jeff Jul 20 '12 at 6:37
    
@Jake That seemed to do the trick. Thanks. –  Jeff Jul 20 '12 at 7:12
    
Although Gonzalo's answer works, I would prefer to see cmhughes answer corrected as that was more in the style of what I was looking for (although Gonzalo's is a perfectly valid answer). –  Jeff Jul 20 '12 at 7:29
add comment

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.