Syntax error How to set the matplotlib figure default size in ipython notebook?

How to set the matplotlib figure default size in ipython notebook?



To set the matplotlib figure default size in iPython, use the following steps −

  • To check the default figure size, use plt.rcParams["figure.figsize"] over the ipython shell.

  • Now to set the figure size, override the plt.rcParams["figure.figsize"] variable with a tuple i.e., (20, 10).

  • After overriding the plt.rcParams["figure.figsize"] variable, you can use it to get changed figure size.

Example

import matplotlib.pyplot as plt

print("Before, figure default size is: ", plt.rcParams["figure.figsize"])
plt.rcParams["figure.figsize"] = (20, 10)
print("After, figure default size is: ", plt.rcParams["figure.figsize"])

Output

Before, figure default size is: [6.4, 4.8]
After, figure default size is: [20.0, 10.0]
Updated on: 2021-03-15T07:45:08+05:30

5K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements