[Tex/LaTex] Coordinate system in LaTeX with TikZ

diagramstikz-pgf

How can I create a simple coordinate system with a linear line in LaTeX using the tikz package? It should look something like this. With the iterating numbers on each axis and all.

enter image description here

Best Answer

Use the tkz-euclide package for simple output.

\documentclass[tikz]{standalone}

\usepackage{tkz-euclide}
\begin{document}
\begin{figure}[h]
\begin{tikzpicture}
   \tkzInit[xmax=6,ymax=6,xmin=-6,ymin=-6]
   \tkzGrid
   \tkzAxeXY
   \draw[ thick,latex-latex] (-1,4) -- (4,-6) node[anchor=south west] {$a$}; % two points for drawing 2x+y=2
  \tkzText[above](0,6.75){Desired Output}
  \end{tikzpicture}
\end{figure}
\end{document}

Output:

output

Related Question