【已解决】关于matplotlib的‘bboxes‘ cannot be empty问题

原报错:

  File "D:\venv\lib\site-packages\matplotlib\transforms.py", line 653, in union    raise ValueError("'bboxes' cannot be empty")ValueError: 'bboxes' cannot be empty

报错原因1:

    fig.tight_layout()

报错原因2:

plt.savefig(result_path,bbox_inches='tight',pad_inches=0)

总之,类似于缩小图片周围空白区域的语句。

解法一:

这句删掉就好了。

解法二:

回顾代码,是否存在

ax.w_zaxis.line.set_visible(False)

之类的语句。

我的本意是想把z轴轴线设为透明,但是会引发上面的错误。我的背景是白色,所以用

ax.w_zaxis.line.set_color('white')

代替了。

posted @ 2023-08-19 21:18  jijfurhg  阅读(160)  评论(0)    收藏  举报