I'm specifically referring to spine placement example code found here, via the matplotlib documentation.
Here's a picture of the problem I'm having:
By using the panning tool, I have moved the left spine for the "zeroed spines" plot beyond the axes it should be bound in, despite the grid and the plot remaining within their bbox
. This problem also occurs for the bottom spine, as well as any of the other plots that have moving spines. I tried setting ax.spines['left'].set_clip_on(True)
but this failed to change anything.
Is there any way to adjust the sample code to ensure that the spines won't be displayed outside of their respective axes, similarly to the axis grid or plot? The only other way I can think to resolve this is to make the spine animated and ensure that ax.spines['left'].set_color(None)
whenever the spine is outside the axis' bbox
by using an event listener, but I'm sure there must be a simpler solution that I am unaware of.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…