I am trying to recreate the dashed line effect seen in the attached image using matplotlib.
I could not find any reference
CodePudding user response:
To do this you need Matplotlib v3.6.0 or higher, in which the (currently experimental)
If you don't have the latest Matplotlib version, or can't upgrade, you can get the effect by just plotting a white line and then a dashed line over the top (or vice versa), e.g.,
plt.plot(d, "g", lw=10)
# plot a white line
plt.axhline(0, color="white")
# overplot a dashed green line
plt.axhline(0, color="g", ls="--"")