# Make axis arrows longer than the graph (pgfplots) [duplicate]

Is there a way to draw the axis arrows of a graph made via pgfplots longer than the graph itself? For reference, here is what my graph currently looks like:

And here is how I want it to look like:

(Sorry for paint)

I currently use axis line style = {-latex}.

Thanks!

Edit:

Minimal working example (by request):

\documentclass{article}

\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[axis lines = middle, axis line style = {-latex}, grid = both]
\end{axis}
\end{tikzpicture}
\end{document}


## marked as duplicate by Mensch, Symbol 1, Community♦Mar 5 '17 at 20:19

• Could you give us a minimal working example? – Artillect Mar 5 '17 at 19:45
• @Artillect Thank you, this worked! Wasn't able to find a solution with the keywords I used. – Skydiver Mar 5 '17 at 19:51
• No problem, glad I was able to find that for you! – Artillect Mar 5 '17 at 19:51

Perhaps you can accommodate the grid yourself, by hand. If you want it to be done automatically, you might like this one:

\documentclass{article}

\usepackage{tkz-euclide}

\begin{document}

\begin{tikzpicture}
\tkzInit[xmax=6,ymax=6,xmin=-6,ymin=-6]
\tkzGrid
\tkzAxeXY
\end{tikzpicture}

\end{document}


But if you want to make detailed changes, I suggest you a more detailed approach:

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw[step=0.5cm,gray,very thin] (-3.7,-3.7) grid (3.7,3.7);
\draw[thick,<->] (-4.5,0) -- (4.5,0);
\draw[thick,<->] (0,-4.5) -- (0,4.5);
\end{tikzpicture}

\end{document}


Here you can control everything: the length of an axis, the size of units (with step=) and even the enumeration (I didn't show it as I'm sure you already have a viable method). As you can see, my grid spectrum is (-3.7,-3.7) grid (3.7,3.7), and both arrows reach 4.5 (positive and negative). So the distance between the end of the grid and arrow tips is 0.8.

As you can see, you are the master of your own grid with TikZ.

• The duplicate link provide solved my problem (which was related to axes created with pgfplots), but this is an easy solution for less complicated applications that solely rely on tikz. Thanks! – Skydiver Mar 5 '17 at 21:04