2

I am new to matplotlib, I was looking into these 2 docs. https://matplotlib.org/api/_as_gen/matplotlib.pyplot.figure.html https://matplotlib.org/api/_as_gen/matplotlib.figure.Figure.html

I wrote the following lines of code to try to get an intuition of a figure.

fig1, ax = plt.subplots(figsize=(3,3),facecolor='black')
print(fig1.get_size_inches()*fig1.dpi)
fig2, axs = plt.subplots(1,2,figsize=(6,3),facecolor='black')
print(fig2.get_size_inches()*fig2.dpi)

The output confuses me. The whole area is one black figure? I save the image which is not 216 by 216 pixels.

Output enter image description here

the width of fig2 should be twice of fig1 though the images are not. any idea?

S.I.
  • 3,250
  • 12
  • 48
  • 77
futom1990
  • 41
  • 1
  • Your intuition is correct. And it'll all work as expected when using matplotlib in a python script. Yet here you are using IPython or Jupyter notebook. I suggest you read through the duplicate and if anything remains unclear, edit the question or ask a new one. – ImportanceOfBeingErnest Aug 17 '18 at 12:21

0 Answers0