# Draw to anchor of new node at coordinate in TikZ

Is there a way to directly draw to a new node, specifying the connection anchor but still center the node at the new coordinates.

To exemplify:

``````% Points at center of node
\draw (root) -- (1,1) node {};

% Connects to north but moves down node
\draw (root) -- (1,1) node[anchor=north] {};
``````

Is there a way to connect to the north anchor and keep the node at `(1,1)` in a single command?

`(1,1) node[anchor=north] {}` tells tikz to place the node at `(1,1)`, but with its north anchor. So its center will be below that point.

To position the node at `(1,1)` and draw a line to the north anchor of the node, position a named node, e.g. `mynode`, at `(1,1)` and draw to `mynode.north`.

``````\node[draw] (root) {}; % at (0,0)
\node[draw] (mynode) at (1,1) {};
\draw (root) -- (mynode.north);
``````

You can put it into a single command like this:

``````\draw (1,1) node[draw] (mynode) {} (root) -- (mynode.north);
``````
• So I presume there is no way to then also connect this to `root.south` in a single line?
– Hans
Jan 28 at 19:02
• `\draw (root) -- (mynode.north) -- (root.south)`? It is not very clear what you after. Jan 28 at 23:03
• I was drawing a tree where I declared a lot of nodes and I wanted to connect all those node's `north` with the root's `south`. I would have preferred to be able to write a single command for each node and not have to first declare them and then connect them.
– Hans
Jan 31 at 10:32
• @Hans It might make sense to post your real problem instead of trying to fix it the way you think it should work. Jan 31 at 11:10