Skip to content

[Bug]: The default Pyplot buttons are unresponsive with Python 3.9.9. #21736

@KennethEvans

Description

@KennethEvans

Bug summary

See https://stackoverflow.com/questions/70072297/pyplot-buttons-do-not-work-reliably-on-windows-10.

I have only tried Python 3.7 as installed in Visual Studio 2019 (where the buttons are ok) and Python 3.9.9, which I installed myself from python.org, (where they do not). I am using Matplotlib 3.5.0 with Python 3.9.9, and have tested 3.3.4 and 3.4.3. I am using 3.3.4 with Python 3.7.

I admit it seems strange that no one else has reported this as far as I can tell.

This is on Windows 10.

Code for reproduction

from math import radians, degrees
import numpy as np
import matplotlib.pyplot as plt

def main():
    x = np.arange(0, radians(1800), radians(12))
    theta = np.arange(0, 1800, 12)
    plt.plot(theta, np.cos(x), 'b')
    plt.title("Plot of cos(x)")
    plt.ylabel("cos(x)")
    plt.xlabel("x, degrees")
    plt.xticks(np.arange(0, 1801, 180))
    plt.grid(True)
    plt.show()

main()

Actual outcome

Buttons usually do not respond (don't show they are pressed and don't do anything). Occasionally they do. Home can typically be depressed but almost never restores the plot.

Expected outcome

Buttons respond (show they are pressed) and do what they should.

Additional information

Works in 3.7.

Operating system

Windows 10

Matplotlib Version

3.5.0, 3.3.4, 3.4.3

Matplotlib Backend

No response

Python version

3.9.9

Jupyter version

No response

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions