0

I want to reduce the distance that the node text gets placed relative to the anchor. I have two nodes like this to add labels to a point in the axis:

\node[red] (point) at (1,0) {\(\bullet\)}; \node[anchor=south west] at (point) {(1,0)}; 

That adds a red dot at the point and a node above right of it with some text. I want to move the text node closer to the point since the automatic placement puts it a bit far away. How do i do that? Is there an option to make placement "tight" or "compact"?

Would it make sense to change from two nodes to one node plus the label option added to the bullet node?

3
  • 2
    Could you edit your code fragment into a small example that we can compile please? Would be helpful to include an image too, help people help you Commented Apr 8, 2023 at 11:44
  • 1
    A label is just a node (bus yes, i would make sense). What you want is to reduce the inner sep value of one of those nodes (or technically a negative outer sep value would work also). It might be better to use a filled circle node instead of \bullet for more control. Commented Apr 8, 2023 at 11:45
  • @Qrrbrbirlbel Thanks, that was exactly what i was looking for. Do you want to create an answer for the question so i can mark it for the points? Commented Apr 11, 2023 at 8:50

1 Answer 1

1

If you need dots (to mark a point/coordinate) it's always better to use an actual circle drawn by TikZ. The glyphs \bullet or \textbullet don't necessarily have their center on the actual coordinate and you can't reference them as good.

A node of shape circle is used best. Setting the inner sep to zero allows the diameter to be given via minimum size.

To put a node closer to that dot it be best to reduce its inner sep. Technically, using a negative outer sep works, too, but I don't see a good reason for it in this case. (See the inner sep value in the every label key.)

Since it seems like you want to label a coordinate on the page, the label key is a nice way to place another node in reference to a given node without having to give it an explicit name. It allows you to use a style like dot in the second code which not only adds the label but also places the dot on the right coordinate without having to give it twice. (Though, this will not always work, of course.)

Code

\documentclass[tikz]{standalone} \begin{document} \tikz[ bullet/.style={shape=circle, fill, draw, inner sep=+0pt, minimum size=+3.5pt}, every label/.append style={inner sep=+.1em} ] \node[bullet, red, label={north east:$(1, 0)$}] at (1,0) {}; \tikz[ dot/.style args={#1:#2}{bullet, label={#1:$#2$}, at={#2}, node contents=}, bullet/.style={shape=circle, fill, draw, inner sep=+0pt, minimum size=+3.5pt}, every label/.append style={inner sep=+.1em} ] \node[red, dot={north east:(1, 0)}]; \end{document} 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.