To adjust figure size in matplotlib, we can use figure()
method from matplotlib. We can pass figsize
parameter to it to set the size of the figure. Here's an example:
main.py206 chars11 lines
In the above code, we created a figure with a size of 8 inches in width and 6 inches in height using figsize=(8, 6)
parameter. Then we plotted a chart using the same figure and displayed it using plt.show()
method. By default, the figure size is set to (6.4, 4.8) so we can use bigger size if we want to display bigger chart.
gistlibby LogSnag