[Tex/LaTex] Draw square and add values

drawtikz-datavisualization

I want to add coordinates in the corners of a square grid.

Do you know how to place values in the vertices of square?

Best Answer

A square grid (3 × 3) with coordinates in the corners:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
  \draw (0, 0) grid (3, 3);
  \path
    (0, 0) node[below left] {$(0, 0)$}
    (3, 0) node[below right] {$(3, 0)$}
    (3, 3) node[above right] {$(3, 3)$}
    (0, 3) node[above left] {$(0, 3)$}
  ;
\end{tikzpicture}\quad
\begin{tikzpicture}
  \draw (0, 0) rectangle (2, 2);
  \path
    (0, 0) node[below left] {$(0, 0)$}
    (2, 0) node[below right] {$(2, 0)$}
    (2, 2) node[above right] {$(2, 2)$}
    (0, 2) node[above left] {$(0, 2)$}
  ;
\end{tikzpicture}
\end{document}

Result

Values can be placed with the same method.

Of course, there are many other tools and packages for more sophisticated plots like pgfplots. But these packages usually come with documentation and the question does not mention much details to write a meaningful example.

Related Question