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()
Using figurepyplot. figure that is used to create a new figure or activate an existing one. The method accepts an argument called figsize that is used to specify the width and height of the figure (in inches). Additionally, you can even specify dpi that corresponds to the resolution of the figure in dots-per-inch.
Occasionally, problems with Matplotlib can be solved with a clean installation of the package. In order to fully remove an installed Matplotlib: Delete the caches from your Matplotlib configuration directory. Delete any Matplotlib directories or eggs from your installation directory.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With