How can I shift a line the endpoints of which are defined by anchors like this?
\draw (i0) -- (i1);
The following approach does not work:
\draw[xshift=2pt] (i0) -- (i1);
tikz-pgf
How can I shift a line the endpoints of which are defined by anchors like this?
\draw (i0) -- (i1);
The following approach does not work:
\draw[xshift=2pt] (i0) -- (i1);
Best Answer
Approach 1
You can work with the library
calc
:Approach 2
Another approach based on the
let
operation. An example is given in the question TikZ: Node at same x-coordinate as another node, but specified y-coordinate?Approach 3
Jake mentioned another approach. You set the shift to the coordinate directly. (this method is documented in the manual section 13 "Specifying Coordinates")
Note: By using this method will work fine if you define
i0
andi1
with\coordinate
. If you definei0
andi1
with\node
you must give an anchorThis limitation isn't relevant for the other approaches.
Complete example with result