this is my first post so please correct me if I am doing something wrong. I wish to draw a tikzpicture with nodes and use here absolute coordinates. I don't know why, but somehow my coordinates seem to be relative and not absolute. In this code sample, for instance, one node should be positioned at (0,0) but instead is somewhere in the negative area of the coordinate system. What am I doing wrong?

width =0.9\textwidth,
height = 0.9\textwidth,
legend cell align=left,
legend pos=outer north east,
legend style={draw=none, anchor=north west, at={(1.1,1)},font=\Large,    
xmin=-124, xmax=160,
every tick label/.append style={font=\Large},
yticklabel style={text width=3em,align=right},

\begin{axis}[grid=major, ymin=-50, ymax=150]
\node(0) at (0,0)[rectangle,draw, minimum size = 5pt, fill = black,   
inner sep = 0pt]{};
\node(1) at (-5, 70)[minimum size = 3.7pt, fill= white, inner sep = 0pt, 
shape = circle, draw]{};
\node(2) at (-17, 69)[minimum size = 3.7pt, fill= white, inner sep = 0pt, shape = circle, draw]{};
\node(3) at (-19, 85)[minimum size = 3.7pt, fill= white, inner sep = 0pt, shape = circle, draw]{};
\node(4) at (9, 99)[minimum size = 3.7pt, fill= white, inner sep = 0pt, shape = circle, draw]{};
\node(5) at (15, 82)[minimum size = 3.7pt, fill= white, inner sep = 0pt, shape = circle, draw]{};

  • 1
    The default coordinate system is that of the tikz picture, not the axis. You can get what you want by doing ... at (axis cs: 0,0) etc
    – Thruston
    May 3, 2016 at 10:09
  • Or you could add \pgfplotsset{compat=1.13} to the preamble, in which case axis cs is default. (This applies to compat settings of 1.11 and higher.) So I'm assuming you need to refer to the nodes at some later point? Because if you don't need that, it's much easier to draw the circles with \addplot. May 3, 2016 at 10:15

1 Answer 1


It is important to note that you are not only using TikZ, but also PGFPlots. As described in section 4.17.1 (Accessing Axis Coordinates in Graphical Elements) in the manual, there are different coordinate systems in PGFPlots:

  • axis cs: the axis coordinate system

  • rel axis cs: a relative coordinate system, where the complete axis vectors are normalized to 1

  • axis direction cs: allows to use relative positions and directions
  • axis description cs: useful for (of course) axis descriptions
  • ticklabel cs:,xticklabel cs:,yticklabel cs:,zticklabel cs: for positioning the tick labels
  • xticklabel* cs:,yticklabel cs:,zticklabel cs: are the same as the non-starred versions, but do not take the size of any tick labels into account

All of these are different from the default TikZ coordinate system. In your case, you'll probably want to use the axis coordinate system axis cs:, to place nodes at absolute coordinates within your axis. As @Thruston says in his comment, you can place a node within this (or any other of the above) coordinate system with

\node at (axis cs:0,0) {};

The developers of PGFPlots have designed PGFPlots to be fully backwards-compatible. New features, which would make old diagrams look different with a new version, are disabled by default and have to be enabled manually. This can be done with


where *version* is the PGFPlots version number, e.g. 1.11 or 1.13. As shown in a comment by @Torbjørn T., from version 1.11 on, the axis cs: coordinate system is the default, so you don't need to specify it at every use. Thus, with \pgfplotsset{compat=1.13} in your preamble, the diagram will look as you'd expect, without any changes to your code.

A small note: You specify the options [minimum size=3.7pt, fill=white, inner sep=0pt, shape=circle, draw] for every drawn point. If you want to change that later, you'd have to go through all nodes and change it. Alternatively, you can specify a style with

    mydot/.style={minimum size=3.7pt, fill=white, inner sep=0pt, shape=circle, draw}
    \node[mydot] at (-5, 70) {};

With that, you'll only have to specify the style once.

  • Thank you so much, it solved my problem! And yes, I need to refer to nodes later on, that's why I cannot work with addplots.
    – SandraZ
    May 4, 2016 at 7:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .