2

Based on the answer in TikZ Adding Text, I tried the below example to display the coordinates as text in the Tikz figure. But the code is not compilable.

How do I add text to a coordinate in tikz without using the \node command.

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
  \draw[thick,rounded corners=8pt] (0,0) {0,0} -- (0,2) {0,2}; 
\end{tikzpicture}
\end{document} 

After the suggestion from @JouleV, I have the following:

enter image description here

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
  \draw (-5,0) node {-5,0} -- (5,0) node {5,0};
  \draw (0,-5) node {0,-5} -- (0,5) node {0,5};
  \draw (0,0) circle [radius=3cm];
\end{tikzpicture}
\end{document}

How to ensure that there is enough space between the text and lines?

  • \draw (0,0) node {0,0}--(0,2) node {0,2};. Have a look at this. – The old JouleV Feb 23 at 4:20
  • @JouleV thanks. It works. but now there is no enough space between the text and the lines. How do I introduce the space. – subham soni Feb 23 at 4:26
5

You just have to add some options to it.

\documentclass[tikz,margin=3mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0,-5) node[below] {$(0,-5)$}--(0,5) node[above] {$(0,5)$};
\draw (-5,0) node[left] {$(-5,0)$}--(5,0) node[right] {$(5,0)$};
\draw (0,0) circle (3cm);
\end{tikzpicture}
\end{document}

enter image description here

In fact you can add every possible option for \node.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.