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

ImageView doesn't display data if plotting with PyPlot occurs first #295

Closed
mgalenb opened this issue Oct 28, 2023 · 2 comments
Closed

ImageView doesn't display data if plotting with PyPlot occurs first #295

mgalenb opened this issue Oct 28, 2023 · 2 comments

Comments

@mgalenb
Copy link

mgalenb commented Oct 28, 2023

I am getting a strange error when using ImageView and PyPlot in the same project. This is on a Linux machine with Julia 1.9.3 and most recent versions of ImageView (0.12.0) and PyPlot (2.11.2)

I made a clean project with activate --temp and add ImageView,PyPlot

Then I do this, ordering seems to mater?

using PyPlot
fig,ax=subplots()
ax.plot(rand(100))
#displays a plot with data

using ImageView
ImageView.imshow(rand(100,100,10))
#displays a window but no data inside, see picture

Screenshot 2023-10-28 at 11 17 20 AM

It appears related to plotting with PyPlot first

if I do this

using ImageView,PyPlot
ImageView.imshow(rand(100,100,10))
#good image

Screenshot 2023-10-28 at 11 21 20 AM

I can even make plots with PyPlot and also keep making new windows with ImageView.imshow, but I have to do ImageView.imshow first.

@mgalenb mgalenb changed the title ImageView doesn't display data if project includes PyPlot ImageView doesn't display data if plotting with PyPlot occurs first Oct 28, 2023
@jwahlstrand
Copy link
Collaborator

jwahlstrand commented Oct 28, 2023

I can confirm this, also on Linux. It seems like it must be some sort of bad interaction between the Tk and GTK event loops. There is a lot of information on this in #262, #149, #128, and JuliaGraphics/Gtk.jl#493. It sounds like changing the PyPlot backend was settled on as the solution.

On ImageView 0.11.7, if you use PyPlot first and then call imshow, the image window does show up and can be interacted with, but the PyPlot window refuses to close and the REPL becomes unresponsive. Like 0.12.0, calling imshow before PyPlot functions seems to work fine.

@jwahlstrand
Copy link
Collaborator

This is an issue with Gtk4, not this package, so I'm going to close this. I added a note to the Gtk4 README about PyPlot issues and workarounds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants