I am trying to produce a sequence/time diagram showing the synchronisation process of a master and slave in the Precision Time Protocol using TikZ. Being very new to TikZ I don't know much more than the primitives for drawing lines and placing nodes, which seems almost enough for such a simple diagram.

The problem I am having is that I cannot figure out how to make lines and arrows converge precisely in a single point on an axis. Here is what it looks like now (not the actual diagram but close):

Up close:

As you can see there is quite a gap between the three lines converging on the t-axis. How do I remove such gaps and have the lines converge precisely in one point on the t-axis?

Or is there a better way to draw such diagrams?

Here is a MWE:



    \draw [->,thick] (0,8) node (Master) [above] {Master} -- (0,0) node [below right] {t};
    \draw [->,thick] (5,8) node (Slave) [above] {Slave} -- (5,0) node [below right] {t};

    \node (t1) at (0,7) [left] {$t_1$};
    \node (t2) at (5,6) [right] {$t_2$};
    \node (t3) at (0,3) [left] {$t_3$};
    \node (t4) at (5,1) [right] {$t_4$};

    \draw[->] (t1) -- (t2);
    \draw[->] (t2) -- (t3);
    \draw[->] (t3) -- (t4);

    \draw[very thin,dashed] (t2) -- ++(-6,0);
    \draw[very thin,dashed] (t3) -- ++(6,0);
    \draw[very thin,dashed] (t1) -- ++(6,0);
    \draw[very thin,dashed] (t4) -- ++(-6,0);

Thanks in advance!

  • 1
    This happens because with the (node) syntax (as opposed to (node.anchor)), TikZ stops the line at the border of the node (which contains the text plus a margin of size inner sep). – Caramdir Jun 4 '11 at 16:47

I suggest you this:

\draw[->] (t1.east) -- (t2.west);
\draw[->] (t2.west) -- (t3.east);
\draw[->] (t3.east) -- (t4.west);

The result is the following

enter image description here

I suggest you to use latex 45 arrow style. Bye

  • Thank you, that's it! But I can't seem to find a "latex 45" arrow style, only "latex" and variants and various "triangle 45" or "angle 45" styles. But the "latex" style is quite adequate I think. – daff Jun 4 '11 at 5:01
  • 4
    Maybe he meant arrow 45 accessible by usetikzlibrary{arrows}? Anyway, choose the tip you prefer! You should also consider a different strategy of building your picture: You actually want to draw an arrow to a point (you can use node[shape=coordinate]) on the vertical line, not to the text. The text can be placed as a label next to that coordinate. – Christoph Jun 4 '11 at 7:12
  • Yeah, I meant arrow 45, sorry!! – Azoun Jun 4 '11 at 13:55

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.