Drawing minimal xy axis
with TiKZ
:
\documentclass[tikz,border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[help lines, color=gray!30, dashed] (-4.9,-4.9) grid (4.9,4.9);
\draw[->,ultra thick] (-5,0)--(5,0) node[right]{$x$};
\draw[->,ultra thick] (0,-5)--(0,5) node[above]{$y$};
\end{tikzpicture}
\end{document}
Why pgfplots
is left out?
\documentclass[border=2mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[grid=both,ymin=-5,ymax=5,xmax=5,xmin=-5,xticklabel=\empty,yticklabel=\empty,
minor tick num=1,axis lines = middle,xlabel=$x$,ylabel=$y$,label style =
{at={(ticklabel cs:1.1)}}]
\end{axis}
\end{tikzpicture}
\end{document}
A PSTricks solution:
\documentclass{article}
\usepackage{pst-plot}
\begin{document}
% parameter
\def\size{5} % natural number
\begin{pspicture}(-\size,-\size)(\size.57,\size.62)% found manually
\multido{\iA = -\size+1}{\numexpr2*\size+1}{%
\multido{\iB = -\size+1}{\numexpr2*\size+1}{%
\psset{linewidth = 0.5\pslinewidth, linestyle = dashed, linecolor = gray!50}
\psline(-\size,\iA)(\size,\iA)
\psline(\iB,-\size)(\iB,\size)}}
\psaxes[labels = none]{->}(0,0)(-\size,-\size)(\size.21,\size.21)[$x$,0][$y$,90]
\end{pspicture}
\end{document}
All you have to do is choose the value of \size
and the drawing will be adjusted accordingly.
I've drawn the grid manually since pstricks-add
's function for this makes it look wierd, I think.