Python matplotlib 中超过 9 个子图

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4158367/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 14:31:23  来源:igfitidea点击:

more than 9 subplots in matplotlib

pythonchartsmatplotlib

提问by relima

Is it possible to get more than 9 subplots in matplotlib?

是否有可能在 matplotlib 中获得 9 个以上的子图?

I am on the subplots command pylab.subplot(449);how can I get a 4410to work?

我在 subplots 命令上,pylab.subplot(449);我怎样才能4410工作?

Thank you very much.

非常感谢。

采纳答案by relima

It was easier than I expected, I just did: pylab.subplot(4,4,10)and it worked.

这比我预期的要容易,我就是这样做的:pylab.subplot(4,4,10)而且它奏效了。

回答by Roman

You can also do it like this with pyplot:

你也可以用 pyplot 这样做:

import matplotlib.pyplot as plt
oFig1 = plt.figure(1)

oFig1.add_subplot(4,4,11)      #(m,n,x) -> x starts with 1
...

回答by HS-nebula

You could also do

你也可以这样做

import matplotlib.pyplot as plt

N = 10 # number of subplots you want
fig, axes = plt.subplots(nrows = N)

Then len(axes) = N, meaning you'll have an axis for each subplot to work with.

然后len(axes) = N,这意味着您将为每个子图使用一个轴。