Is there are posibility to break a line in a matplotlib diagram. I made a sketch for better understanding what I mean.
CodePudding user response:
If by 'intercept' you mean the gaps or buffers between the points and the lines, I'd add an edge around the points like so:
import matplotlib.pyplot as plt
x = y = [1, 2, 3]
fig, ax = plt.subplots()
ax.plot(x, y, lw=5, c='k') # The black line.
ax.scatter(x, y, s=200, c='lime', ec='white', lw=5, zorder=10)
ax.set_xlim(0.5, 3.5)
ax.set_ylim(0.5, 3.5)
This prodices:
I'm plotting the line and points separately, controlling the layer order with zorder
. There are always lots of ways to do things, but I find markers easier to control with plt.scatter()
.