Skip to content

Wrong backend selection with PyQt4 #5650

Closed
@soupault

Description

@soupault

I'm trying to execute script, which uses only matplotlib (none of PyQt classes/tools directly).
This's the traceback I get:

Traceback (most recent call last):
  File "C:/Workspace/project/src/main.py", line 189, in <module>
    fig, axes = plt.subplots(nrows=nrows, ncols=1, sharex=True)
  File "C:\Miniconda3\lib\site-packages\matplotlib\pyplot.py", line 1177, in subplots
    fig = figure(**fig_kw)
  File "C:\Miniconda3\lib\site-packages\matplotlib\pyplot.py", line 527, in figure
    **kwargs)
  File "C:\Miniconda3\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 43, in new_figure_manager
    return new_figure_manager_given_figure(num, thisFig)
  File "C:\Miniconda3\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 50, in new_figure_manager_given_figure
    canvas = FigureCanvasQTAgg(figure)
  File "C:\Miniconda3\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 216, in __init__
    super(FigureCanvasQTAgg, self).__init__(figure=figure)
  File "C:\Miniconda3\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 65, in __init__
    super(FigureCanvasQTAggBase, self).__init__(figure=figure)
  File "C:\Miniconda3\lib\site-packages\matplotlib\backends\backend_qt5.py", line 239, in __init__
    super(FigureCanvasQT, self).__init__(figure=figure)
TypeError: 'figure' is an unknown keyword argument

Once I add this line to the import sections, everything starts to work fine:

matplotlib.use('Qt4Agg')

SW versions:

  • Python 3.5.1 (conda);
  • PyQt4-4.11.4-cp35-none-win_amd64.whl (C.Gohlke website);
  • matplotlib 1.5.0 (C.Gohlke website);
  • Win 7 x64.

UPD:
Same situation for:

  • Python 3.4.3 (conda);
  • PyQt4-4.11.4-cp34-none-win_amd64.whl (C.Gohlke website);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions