Skip to main content
2 of 5
deleted 79 characters in body; edited title
hana
  • 2.6k
  • 6
  • 19

How to create a line with label on top?

Can anyone help me create a line with label like this? The line is cut in the middle. The label is placed on top to avoid the probelem when too points are too close.

enter image description here

This is what I have so far.

lines[{a1_, a2_}, color_, label_] := Block[{},
  {Thickness[0.01], color, Line[{a1, a2}]}]

Graphics@lines[{{1, 2}, {3, 5}}, Red]
hana
  • 2.6k
  • 6
  • 19