删除子图 [英] Delete a subplot
本文介绍了删除子图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试找出一种在matplotlib中删除(动态)子图的方法.我看到他们有一个remove
方法,但是出现错误
I'm trying to figure out a way of deleting (dynamically) subplots in matplotlib. I see they have a remove
method, but I get the error
NotImplementedError: cannot remove artist
我很惊讶在任何地方都找不到.有人知道该怎么做吗?
I'm surprised that I can't find this anywhere. Does anyone know how to do this?
推荐答案
哇,好吧,我真的很蠢:P
Wow, ok well I feel really stupid :P
from matplotlib import pyplot as plt
fig, axs = plt.subplots(1,3)
axs[0].plot([1,2],[3,4])
axs[2].plot([0,1],[2,3])
fig.delaxes(axs[1])
plt.draw()
万一其他人需要它.
这篇关于删除子图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文