Skip to content

[Bug]: Broken functionality: Qt5/PySide2, using interactive mode, fig.canvas.draw() then fig.canvas.flush_events() leaves plot in non-interactive state. #28959

Closed
@chrisgmorton

Description

@chrisgmorton

Bug summary

Matplotlib 3.9.0, PySide2 with Qt5 5.15.2, Python 3.11.9, IPython 8.25.0 (or jupter qtconsole 5.5.2)

The attached code leaves the plot in a non-interative state.

The blank figure comes up correctly with the plt.figure() call. The plot draws correctly at fig.canvas.flush_events(). the final state is not interactive.

Code for reproduction

import matplotlib
matplotlib.use('Qt5Agg')

import matplotlib.pyplot as plt
import numpy as np

x=np.arange(10)
y=x*x

plt.ion()

fig=plt.figure()
ax=fig.add_subplot(111)
line,=ax.plot(x,y)

fig.canvas.draw()
fig.canvas.flush_events()

Actual outcome

Plot is not responsive but is displayed correctly.

Expected outcome

Should be able to interact with the plot, including selection of toolbar buttons, zooming etc.

Additional information

The submission is a simplified use-case of a more complex applicaion under development. The plots in the application used to be left in an interactive state once the applications simulation completes execution.

Operating system

Ubuntu 20.04

Matplotlib Version

3.9.0

Matplotlib Backend

Qt5Agg

Python version

3.11.9

Jupyter version

IPython 8.25.0 or jupyter qtconsole 5.5.2

Installation

from source (.tar.gz)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions