[Python] Matplotlib Plot Not Responding in VSCode Debug Mode

Discussão em 'Python' iniciado por Stack, Fevereiro 12, 2025.

  1. Stack

    Stack Membro Participativo

    I'm encountering an issue when trying to plot a simple graph using Matplotlib in Python while in debug mode in VSCode. The plot works perfectly in normal execution mode, but when I set a breakpoint and run the code in debug mode, the plot window becomes unresponsive.

    Example Code:


    import matplotlib.pyplot as plt

    # Sample data
    x = [1, 2, 3, 4, 5]
    y = [10, 20, 25, 30, 40]

    # Plotting the data
    plt.plot(x, y)
    plt.title('Sample Plot')
    plt.xlabel('x-axis')
    plt.ylabel('y-axis')

    # Show plot
    plt.show()


    In normal execution mode, the plot window appears and is responsive. In debug mode with a breakpoint, the plot window appears but becomes unresponsive and eventually throws a "not responding" error.

    [​IMG]

    I tried using different Matplotlib backends, but none of them resolved the issue. I expect to be able to plot graphs using Matplotlib in debug mode vscode without the plot window becoming unresponsive.

    Continue reading...

Compartilhe esta Página