原文链接:http://www.juzicode.com/archives/2498
错误提示:
使用matplotlib画子图时提示:ValueError: Single argument to subplot must be a three-digit integer, not 3411
Traceback (most recent call last):
File "13-plt-subplot-子图限制.py", line 30, in <module>
ax3 = plt.subplot(3411)
File "D:\Python\Python38\lib\site-packages\matplotlib\pyplot.py", line 1142, in subplot
ax = fig.add_subplot(*args, **kwargs)
File "D:\Python\Python38\lib\site-packages\matplotlib\figure.py", line 1402, in add_subplot
ax = subplot_class_factory(projection_class)(self, *args, **kwargs)
File "D:\Python\Python38\lib\site-packages\matplotlib\axes\_subplots.py", line 39, in __init__
self._subplotspec = SubplotSpec._from_subplot_args(fig, args)
File "D:\Python\Python38\lib\site-packages\matplotlib\gridspec.py", line 666, in _from_subplot_args
raise ValueError(
ValueError: Single argument to subplot mu
Matplotlib画子图错误提示及解决方法

博客介绍了使用matplotlib画子图时出现的错误提示,即'Single argument to subplot must be a three - digit integer, not 3411',分析可能原因是用单个参数表示行列和位置时,必须是3位数且z<=x*y、z只能用1 - 9的数值,还给出了将subplot方法入参用3个整数表示的解决方法。
最低0.47元/天 解锁文章





