53

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.

Iharob Al Asimi
  • 52,653
  • 6
  • 59
  • 97
relima
  • 3,462
  • 5
  • 34
  • 53

3 Answers3

73

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

Iharob Al Asimi
  • 52,653
  • 6
  • 59
  • 97
relima
  • 3,462
  • 5
  • 34
  • 53
8

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
...
Roman
  • 8,826
  • 10
  • 63
  • 103
0

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.

m13op22
  • 2,168
  • 2
  • 16
  • 35