Plot width settings in ipython notebook


Using plt.rcParams["figure.figsize"], we can get the width setting.

Steps

  • To get the plot width setting, use plt.rcParams["figure.figsize"] statement.

  • Override the plt.rcParams["figure.figsize"] with a tuple (12, 9).

  • After updating the width, get the updated width using plt.rcParams["figure.figsize"].

Examples

In IDE

Example

import matplotlib.pyplot as plt
print("Before, plot width setting:", plt.rcParams["figure.figsize"])
plt.rcParams["figure.figsize"] = (12, 9)
print("Before, plot width setting:", plt.rcParams["figure.figsize"])

Output

Before, plot width setting: [6.4, 4.8]
Before, plot width setting: [12.0, 9.0]

In IPython

Example

In [1]: from matplotlib import pyplot as plt

In [2]: plt.rcParams["figure.figsize"]

Output

Out[2]: [6.4, 4.8]

Updated on: 16-Mar-2021

513 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements