Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Plot does not show unless it is resized #25768

Closed
bjmarfito opened this issue Apr 26, 2023 · 16 comments
Closed

[Bug]: Plot does not show unless it is resized #25768

bjmarfito opened this issue Apr 26, 2023 · 16 comments
Labels
GUI: MacOSX status: needs clarification Issues that need more information to resolve.

Comments

@bjmarfito
Copy link

Bug summary

The plot generated from matplotlib.pyplot does not show automatically. Instead, I need to resize the window plot for it to show.

Code for reproduction

from matplotlib import pyplot as plt
import numpy as np
a = np.array([1, 7, 8, 12])
b = np.array([9, 6, 2, 5])
plt.figure(1, figsize=(8,4))
plt.axis([0,15,0,10])
plt.plot(a,b)
plt.show()

Actual outcome

actual

Expected outcome

expected

Additional information

No response

Operating system

macOS 13.3.1

Matplotlib Version

3.7.1

Matplotlib Backend

MacOSX

Python version

Python 3.11.3

Jupyter version

No response

Installation

None

@bjmarfito bjmarfito changed the title [Bug]: Plot does not show unless the plot is resized [Bug]: Plot does not show unless the it is resized Apr 26, 2023
@tacaswell
Copy link
Member

Are you running this as a stand alone script or by typing into a terminal? If a terminal, which one?

Looks like we are missing a draw command? My guess is minimizing and the restoring the window should also work as would be adding plt.gcf().canvas.draw_idle() right before the show().

@greglucas
Copy link
Contributor

I can't reproduce this in python, ipython, or a standalone script (I'm on an intel mac). I know this is the way it used to be on earlier Matplotlib versions but I thought this was fixed on the most recent releases. I also see that you have a "Figure 3" in the title, but only one figure in the example, so perhaps something with multiple figures going on?

@jklymak
Copy link
Member

jklymak commented Apr 26, 2023

And do you use any non-standard window managers (moom, etc)?

@bjmarfito
Copy link
Author

Hi, sorry for the late response. The problem still persists in my computer.
@tacaswell, I ran it in a terminal using iTerm.

@greglucas, I did not used multiple figures. I messed up with the title of the figure in the screenshot.

@jkl, I used magnet as one of my window managers.

Attaching the screenshots of my terminal and the output after running the plt.show() script.
output

script_in_terminal

@bjmarfito
Copy link
Author

Screenshot after resizing the plot.
resize

@jklymak
Copy link
Member

jklymak commented Apr 28, 2023

I'd suggest turning magnet off and seeing if the problem persists.

@bjmarfito
Copy link
Author

@jklymak, I turned off magnet and still the problem persists.

@wrnod
Copy link

wrnod commented May 29, 2023

Can confirm this problem exists on Intel Macos 13.3.1, Python 3.11.3, matplotlib 3.7.1. Interestingly in the given example the problem does not exist for me, but in other code.

@bjmarfito bjmarfito changed the title [Bug]: Plot does not show unless the it is resized [Bug]: Plot does not show unless it is resized May 30, 2023
@greglucas
Copy link
Contributor

Unfortunately, I still can't reproduce the issue. Is there something external we need to install to see this or a system setting we need to enable? I've tried running on an external monitor and HiDPI display and both work as expected for me.

@bjmarfito
Copy link
Author

Thank you all. This issue is not present anymore after I upgraded my arm64 Mac to macOS 13.4.

@wrnod
Copy link

wrnod commented Jun 11, 2023

This is not resolved. Updating MacOS on Intel to 13.4 did not resolve the issue.
Screenshot 2023-06-11 at 13 57 13

@jklymak
Copy link
Member

jklymak commented Jun 11, 2023

@wrnod you and OP may have some system setting or utility that is causing the problem. It's hard for us to debug without more information.

@bjmarfito
Copy link
Author

Hi @wrnod, I will reopen this issue until it is resolved.

@bjmarfito bjmarfito reopened this Jun 12, 2023
@jklymak jklymak added status: needs clarification Issues that need more information to resolve. GUI: MacOSX labels Jun 12, 2023
@greglucas
Copy link
Contributor

@wrnod are you able to provide any additional information to help with debugging? None of the maintainers are able to reproduce this which makes it really hard to track down what is going wrong. If you have explicit steps you're taking, or previous versions that work and ones that caused issues that would be valuable information.

  1. Are you calling a test script from the command line, running interactively, using Jupyter, ... (give explicit steps)
  2. What Python are you using? Is it installed from Brew, Conda, or manually installed, ...
  3. Are you using a window manager on the system?
  4. Are there any other system settings that come to your mind on possibly making a difference here?

@wrnod
Copy link

wrnod commented Jun 14, 2023

@wrnod are you able to provide any additional information to help with debugging? None of the maintainers are able to reproduce this which makes it really hard to track down what is going wrong. If you have explicit steps you're taking, or previous versions that work and ones that caused issues that would be valuable information.

1. Are you calling a test script from the command line, running interactively, using Jupyter, ... (give explicit steps)

2. What Python are you using? Is it installed from Brew, Conda, or manually installed, ...

3. Are you using a window manager on the system?

4. Are there any other system settings that come to your mind on possibly making a difference here?

Thank you for the follow-up questions. Unfortunately I can't share the code, since it is proprietery. I will try to isolate the issue when I have some time. The issue started for me after updgrading to Python 3.11.3 and matplotlib 3.7.1.

@jklymak
Copy link
Member

jklymak commented Oct 8, 2023

I'll close for lack of further details, but feel free to request a re-open.

@jklymak jklymak closed this as not planned Won't fix, can't repro, duplicate, stale Oct 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GUI: MacOSX status: needs clarification Issues that need more information to resolve.
Projects
None yet
Development

No branches or pull requests

5 participants