Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
384 views
in Technique[技术] by (71.8m points)

python 3.x - Matplotlib zeroed spines extend out of axis when panning

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...