more than 9 subplots in matplotlib

Question:

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

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

Thank you very much.

Asked By: relima

||

Answers:

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

Answered By: relima

You can also do it like this with pyplot:

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

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

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.

Answered By: m13op22
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.