Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> Python

Hiển thị đồ thị Matplotlib toàn màn hình (fullscreen)

Dùng manager.full_screen_toggle() để chuyển figure sang chế độ toàn màn hình.

  • plt.figure(), plt.plot([1,2], [1,2]).
  • manager = plt.get_current_fig_manager().
  • manager.full_screen_toggle().
  • plt.show().

Ví dụ

from matplotlib import pyplot as plt
plt.rcParams["figure.figsize"] = [7.00, 3.50]
plt.rcParams["figure.autolayout"] = True
plt.figure()
plt.plot([1, 2], [1, 2])
manager = plt.get_current_fig_manager()
manager.full_screen_toggle()
plt.show()

Kết quả

Cửa sổ figure mở ở chế độ toàn màn hình (fullscreen).