1

Is it possible to shorten line segments in a matplotlib plot to produce an image like the one below, where the line segments do not completely reach the point markers?

Plot with shortened edges

1 Answers1

2

I've found the following stupid way, but for me it works

import matplotlib.pyplot as plt

x = [0, 1, 2, 3, 4, 5]
y = [1, 3, 2, 5, 3, 1]
plt.figure()
plt.plot(x,y,'b-')
plt.plot(x,y,'wo', markersize=25, markeredgecolor = 'w')
plt.plot(x,y,'bo', markersize=7, markeredgecolor = 'w')
plt.show()
Roman Fursenko
  • 688
  • 4
  • 9
  • That works fine as long as you only have one plot. If several plots overlap, they can interfere with each other. There does not seem to be another way that would be reasonably simple, though. –  Mar 29 '13 at 12:39