0

I am using Python 3.7. I would like to change my backend temporarily so that I can zoom in/out of my data. However, generating figures using qt backend gives me a ValueError, even if the figure is minimally simple.

Here is a minimum example, where I typed the following commands in the console one by one

[Input Commands]

import matplotlib.pyplot as plt
%matplotlib qt
plt.plot([1,2],[1,2])

[Output Error]

[<matplotlib.lines.Line2D at 0x1b2efda7648>]Traceback (most recent call last):
  File "C:\Users\USER_NAME\anaconda3\lib\site-packages\matplotlib\backends\backend_qt.py", line 455, in _draw_idle
    self.draw()
  File "C:\Users\USER_NAME\anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py", line 431, in draw
    self.renderer = self.get_renderer(cleared=True)
  File "C:\Users\USER_NAME\anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py", line 447, in get_renderer
    self.renderer = RendererAgg(w, h, self.figure.dpi)
  File "C:\Users\USER_NAME\anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py", line 93, in __init__
    self._renderer = _RendererAgg(int(width), int(height), dpi)
ValueError: Image size of 213120x159840 pixels is too large. It must be less than 2^16 in each direction.

I don't think this question is a duplicate of previous questions (here and here) because the error appears even for a very simple figure with no labels.

I thought I had accidentally overwritten some kind of setting file, so I tried re-installing matplotlib using "conda install matplotlib" at the Anaconda prompt, but it didn't help. Changing back to my default backend "%matplotlib inline" generates figures normally.

How can I fix my qt backend?

0 Answers0