Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Plot not displaying correctly when using Matplotlib #30792

Open
Labels
@Ashish-coder-gif

Description

@Ashish-coder-gif

Bug summary

When I try to generate a plot using Matplotlib, it does not display correctly. The output is either blank, partially rendered, or missing elements.

Code for reproduction

Title: Example: Line plot not rendered when callingplt.show() (minimal reproducible example)

Code for reproduction
If possible, please provide a minimum self-contained example. If you have used generative AI as an aid seehttps://matplotlib.org/devdocs/devel/contribute.html#restrictions-on-generative-ai-usage

# Minimal reproducible exampleimportmatplotlibimportmatplotlib.pyplotaspltimportnumpyasnp# Example datax=np.linspace(0,2*np.pi,100)y=np.sin(x)# Create a simple line plotfig,ax=plt.subplots()ax.plot(x,y,label="sin(x)")ax.set_title("Sine wave")ax.legend()# This call should display the figure, but in my environment it shows a blank window / nothing is rendered.plt.show()

Actual outcome

Paste the output produced by the code provided above, e.g. console output, images/videos produced by the code, any relevant screenshots/screencasts, etc.

When running the code above:

The window opens but is blank (no axes or line visible), OR

The figure does not appear at all in my environment, OR

The console shows no errors, only the program appears to hang until the window is closed.

(Attach screenshot(s) here showing the blank window or the absence of a plot.)

Expected outcome

The plot should display a sine curve with axes, title, and a legend that reads "sin(x)".

Steps to reproduce

Create a new Python file with the code above.

Run with python example.py (or run inside your IDE/script runner).

Observe the displayed figure (or lack of it).

Environment

OS: e.g. Windows 10 / Ubuntu 22.04 / macOS 13.4

Python version: e.g. 3.10.6

Matplotlib version: e.g. 3.8.0

Backend: e.g. matplotlib.get_backend() -> 'TkAgg' or 'Qt5Agg' or 'inline' (please paste exact output)

Virtual environment: conda / venv / system Python

If using Jupyter/notebook: kernel and frontend (e.g. JupyterLab 3.6)

Additional information / troubleshooting tried

I tried switching the backend to matplotlib.use("Qt5Agg") and TkAgg with no change.

I verified NumPy and Matplotlib are up to date.

No error messages appear in the console.

The issue happens when running both from terminal and from my IDE.

Additional information

No response

Operating system

No response

Matplotlib Version

3.8.0

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

None

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp