Closed scmanjarrez closed 1 year ago
Hi @scmanjarrez
Thank you for pointing out this behavior of newer matplotlib versions. The proposed solution works, but it still leaves a barely perceptible line (which has 0.1 width). We could make it even thinner, like 0.001, but I figured that the problem is only raised whenever the line style is dashed. Matplotlib allows 0 width for continuous lines (which would be invisible anyway), but it breaks if the (invisible) line is dashed (go figure...).
The line width should be zero only when arrows are drawn. Then, if it is actually invisible, we can have it "continuous", after all, we're not seeing it anyway :-)
So, one solution would be:
line = axs[is_clock].plot(*arrow_coords.T, c=color, lw=0 if draw_arrows else 2,
alpha=alpha, linestyle='--' if (alpha < 1) and (not draw_arrows) else '-')[0]
If you update the PR accordingly, I can merge it. If not, I can make the change myself too, it's your call :-)
Best, Daniel
Thank you Daniel, I've committed the proposed fix.
The line
fig = counter_vs_clock(binary=False)
at the start of the chapter9 raises the following exception using matplotlib 3.6.2 (local jupyerlab), however it runs fine on 3.2.2 (installed on colab):Using 0.1 as line width instead of 0 (https://github.com/matplotlib/matplotlib/issues/8821/) seems to avoid the error and doesn't affect the output of the plot.