9951 explained code solutions for 126 technologies

python-matplotlibHow to change figure size

In order to set figure size, you set size in inches and also change inch size in pixels (we draw 160x160 chart in this example):

import matplotlib.pyplot as plt
plt.figure(figsize=(2, 2), dpi=80)
plt.show()ctrl + c
import matplotlib.pyplot as plt

loads Matplotlib module to use plotting capabilities


change figure params


set figure size in inches


inch size in pixels (80 in our case)


plot specified data


render chart in a separate window