'I used matplotlib, but the error message '<Figure size 720x576 with 0 Axes>' appeared with graph

import matplotlib.pyplot as plt
from matplotlib import font_manager, rc

f_name = font_manager.FontProperties(fname='C:/Windows/Fonts/HANBatangExt.ttf').get_name()
rc('font', family=f_name)

뛰기운동

plt.plot(run_before, run_after, 'ro-')

걷기운동

plt.plot(walk_before, walk_after, 'bo-')
plt.figure(figsize=((10,8)))
plt.show()


Solution 1:[1]

It is not an error but the output you see is due to the fact that you have used

plt.figure(figsize=((10,8)))

after plt.plot. Therefore, you first get a figure on you screen and a figure object is created by plt.figure. To get rid of it, you should first set the figure size before plotting, something like this:

plt.figure(figsize=((10,8)))
plt.plot(run_before, run_after, 'ro-')
plt.plot(walk_before, walk_after, 'bo-')
plt.show()

There are other ways to set the figure size after plotting but since your code is fine enough, you are good to go with the above modification.

Solution 2:[2]

It's not an Error it shows your figure dimensions. If you want to get rid of it try using rcParams parameter

plt.rcParams["figure.figsize"] = (10,8)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sheldore
Solution 2