How to maximize plt.show() using Python on Mac?

MatplotlibPythonData Visualization

To maximize plt.show() using Python on Mac, we can use full_screen_toggle().

Steps

  • Set the figure size and adjust the padding between and around the subplots.
  • Add a subplot to the current figure.
  • Make a piechart with input list.
  • Get the Figure Manager of the current figure.
  • Use full_screen_toggle() to create a full-screen pop-up window.
  • To display the figure, use show() method.

Example

import matplotlib.pyplot as plt

plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True

plt.subplot(1, 1, 1)
plt.pie([1, 2, 3])

mng = plt.get_current_fig_manager()
mng.full_screen_toggle()

plt.show()

Output

raja
Updated on 04-Aug-2021 12:21:20

Advertisements