Plots are an effective way of visually representing data and summarizing it in a beautiful manner. However, if not plotted efficiently it seems appears complicated. In python’s matplotlib provides several libraries for the purpose of data representation.
While making a plot it is important for us to optimize its size. Here are various ways to change the default plot size as per our required dimensions or resize a given plot.
Method 1: Using set_figheight() and set_figwidth()
For changing height and width of a plot set_figheight and set_figwidth are used
Method 2: Using figsize
figsize() takes two parameters- width and height (in inches). By default the values for width and height are 6.4 and 4.8 respectively.
Where, x and y are width and height respectively in inches.
Method 3: Changing the default rcParams
We can permanently change the default size of a figure as per our needs by setting the figure.figsize.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.