9951 explained code solutions for 126 technologies


python-matplotlibHow to set subplot size


In order to change subplots sizes we use figsize() method:

import matplotlib.pyplot as plt

fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(4,2))

axes[0].plot([1,3,2])
axes[1].plot([8,2,5])

plt.show()ctrl + c
import matplotlib.pyplot as plt

loads Matplotlib module to use plotting capabilities

.subplots(

creates set of charts on a single chart area

figsize

set figure size in inches (also set dpi to specify inch size in pixels)

.plot(

plot specified data

.show()

render chart in a separate window