0
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import sys

print(sys.version)
print('Matplotlib version:', mpl.__version__)

t = np.linspace(0, 2*np.pi, 1000)
fig, ax = plt.subplots(figsize=(20, 20))
ax.plot(np.cos(t), np.sin(t))

plt.show()

I am running this script on Spyder 4.0 and displaying on a small monitor. The frame just fills up the monitor and makes what should be a circle look like an ellipse.

The print statements give this output:

Python version: 3.7.6
Matplotlib version: 3.3.3

I want the frame as big as I want. I adapted this solution and changed the import statements to:

import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import platform

The plot fails to show, with this message:

UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
  plt.show()
Forklift17
  • 2,245
  • 3
  • 20
  • 32

1 Answers1

0

Just change the backend to anything other than Tkinter, e.g. to Qt5: enter image description here

Don't forget to restart the kernel for the change to take effect.

Stef
  • 28,728
  • 2
  • 24
  • 52
  • That didn't work. The window just does not want to expand past the screen size. I can't even manually expand it by moving it down and trying to drag-expand the window vertically. – Forklift17 Dec 22 '20 at 01:10
  • It works for me (Arch Linux, openbox) for Qt5, Qt4, Gtk, Gtk3 but not for Tkinter, but the behavior appears to be OS/DE dependent, see [this matplotlib issue](https://github.com/matplotlib/matplotlib/issues/7338). See also [this SO answer](https://stackoverflow.com/questions/42622146/scrollbar-on-matplotlib-showing-page) for how to roll your own backend with scroll bars. – Stef Dec 22 '20 at 08:00