# Cartesian Coordinate Formatting with TikZ

Using TikZ, I would like to create a coordinate plane which describes the rectangular coordinates (x,y). However, I'm not sure how to go about doing this. Here is an example of something I am trying to do:

However, I only want one point, and keep the x and y axes graphed. Also, I would like to have variable representing the coordinate, like (x,y) written instead of (2,3). Finally, I would like (0,x) and (x,0) to be written where the points would be, but without the points actually graphed.

• What have you tried so far? Posting the code for the image would be a good start - or whatever you have towards it. So where the x axis has the mark 2 you also want to have a label (x,0)? (Or did you really mean (0,x)? I was assuming a typo.) Won't that be rather confusing?
– cfr
Commented Oct 18, 2015 at 0:46

\documentclass[pstricks,margin=5mm]{standalone}
\usepackage{pst-plot,pst-eucl}

\begin{document}
\begin{pspicture}[](-3,-3)(6,6)
\psaxes{->}(0,0)(-3,-3)(5.5,5.5)[$x$,0][$y$,90]
\psset{PointNameSep=18pt,PosAngle=45,linestyle=dashed}
\pstGeonode[PointName=A{(3,3)},linecolor=red](3,3){A}
\psCoordinates[linecolor=red,showpoints=false](A)
\end{pspicture}
\end{document}

Next time, please provide at least some code for people to work with. Automation, simplification and modification are left as an exercise for the reader.

\documentclass[border=10pt,tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\path [draw, help lines, opacity=.5]  (-11,-11) grid (11,11);
\foreach \i in {1,...,10} \draw (\i,2.5pt) -- +(0,-5pt) node [anchor=north, font=\small] {$\i$} (-\i,2.5pt) -- +(0,-5pt) node [anchor=north, font=\small] {$-\i$} (2.5pt,\i) -- +(-5pt,0) node [anchor=east, font=\small] {$\i$} (2.5pt,-\i) -- +(-5pt,0) node [anchor=east, font=\small] {$-\i$};
\draw [->] (-10,0) -- (10,0) node [anchor=south] {$x$};
\draw [->] (0,-10) -- (0,10) node [anchor=west] {$y$};
\path [draw=blue, ultra thick, text=blue, densely dashed] (0,6) node [anchor=south west] {$(0,y)$} -| (8,0) node [anchor=south west] {$(x,0)$} node [anchor=south west, midway] {$(x,y)$};
\end{tikzpicture}
\end{document}

Here is the exact reproduction of the picture using tkz-euclide.

\documentclass[border=3]{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
\tkzInit[xmin=-6,ymin=-6,xmax=6,ymax=6]
\tkzAxeXY
\tkzGrid
\tkzDefPoints{0/3/A,
2/3/B,
2/0/C}
\tkzDrawSegments[color=blue, ultra thick, densely dashed](A,B B,C)
\tkzDrawPoints[size=10,color=red](A,B,C)
\tkzLabelPoint[above right,color=blue](A){$(0,3)$}
\tkzLabelPoint[above right,color=blue](B){$(2,3)$}
\tkzLabelPoint[above right,color=blue](C){$(2,0)$}
\tkzDefPoints{0/1/D,
-3/1/E,
-3/0/F}
\tkzDrawSegments[color=red, ultra thick, densely dashed](D,E E,F)
\tkzDrawPoints[size=10,color=red](D,E,F)
\tkzLabelPoint[above left,color=blue](D){$(0,1)$}
\tkzLabelPoint[above left,color=blue](E){$(-3,1)$}
\tkzLabelPoint[above left,color=blue](F){$(-3,0)$}
\tkzDefPoints{0/-2.5/G,
-1.5/-2.5/H,
-1.5/0/I}
\tkzDrawSegments[color=red, ultra thick, densely dashed](G,H H,I)
\tkzDrawPoints[size=10,color=red](G,H,I)
\tkzLabelPoint[right,color=blue](G){$(0,-2.5)$}
\tkzLabelPoint[below,color=blue](H){$(-1.5,-2.5)$}
\tkzLabelPoint[above,color=blue](I){$(-1.5,0)$}

\tkzLabelPoint[above right,color=blue]({0,0}){$(0,0)$}
\end{tikzpicture}
\end{document}

Since this is repetitive code, the number of lines can be reduced by two third. But I left it more verbose so that it is easy to follow.

• Just an update, \usetkzobj{all} is not required for the time being.
– Cenk
Commented May 9, 2020 at 8:08