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

The show() method doesn't seem to work. #561

Closed
marlloseff opened this issue Dec 3, 2022 · 2 comments
Closed

The show() method doesn't seem to work. #561

marlloseff opened this issue Dec 3, 2022 · 2 comments

Comments

@marlloseff
Copy link

Hello everybody! I used show() to re-show a plot that was closed. In Julia 1.8.3 it doesn't seem to work anymore.
x = plot(rand(10), rand(10))

close the window

show() # out: empty
x # out: 1-element Vector{PyCall.PyObject}:
PyObject <matplotlib.lines.Line2D object at 0x7faecfddfd30>
show(x) # out: PyCall.PyObject[PyObject <matplotlib.lines.Line2D object at 0x7faecfddfd30>]
display(x) # out: equal to x

Note: I had to install PyCall with the ENV["PYTHON"]="" option

@stevengj
Copy link
Member

stevengj commented Dec 3, 2022

That's not how Matplotlib works.

If you are using the GUI, then closing the figure deletes it.

If you are using some other interface, e.g. vscode or IJulia/Jupyter, then you can call display(fig) on the figure object. However, the return value of plot is not the figuer object. You can get the figure object from x[1].figure or gcf().

@stevengj stevengj closed this as completed Dec 3, 2022
@marlloseff
Copy link
Author

I am using bash terminal. When I type x[1].figure, the output in the terminal is: Figure(PyObject <Figure size 640x480 with 1 Axes>), but without showing the graph. When I type gcf(), a blank figure appears. I remember re-displaying the graphics (Julia 1.7.2) with just the show() command.

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