0

I'm trying to show a figure in a window like Matlab figures ot matplotlib figures in Python. I am using the Plots.jl package with the Pyplot backend.

I can save my plots as svg or png files, but i do not know ho to show them interactively using IJulia or Julia REPL.

Thank you for your time.

inarighas
  • 720
  • 5
  • 24
  • @PaulH that is false, Plots.jl does lots of interactivity. – Chris Rackauckas Feb 14 '18 at 16:00
  • @jdv Those other issues aren't relevant here. Those issues have to do with interactive Plotly plots going away after you close a notebook and open it back up. First of all, that's the Plotly backend and not the PyPlot backend. Secondly, that's not that it's non-interactive, it's that the plot doesn't come back after the notebook is re-opened (i.e. it'll work until you close the notebook). That's really not relevant here so I assume you're trolling? Please point to a single issue on rendering PyPlot plots in Jupyter notebooks, because there's not one in the Plots.jl repo. – Chris Rackauckas Feb 14 '18 at 16:04
  • When you call plot in the REPL with the PyPlot backend it's interactive. Does it not do that for you @PaulH? The window has buttons and everything. That table at the top is just about recommendations: the PlotlyJS backend is recommended for interactivity, but PyPlot's GUI window is interactive (it's the standard matplotlib window). But I think that a quick PR to the docs should add it to the interactive line: the matplotlib window is quite interactive (allowing for things like dragging for rotation) so I don't see a reason to exclude it from the recommended methods. – Chris Rackauckas Feb 14 '18 at 16:09
  • 1
    @ChrisRackauckas "Trolling?" Really? Show me on this StackOverflow doll where I "trolled" anyone. I'm pointing out that some research, not shown here, suggests that similar problems are reported in the very places that hosts the software under discussion (I mention IJulia specifically, but it was actually one of the silly "py" and "plot" named sites as well). I'm not sure why a completely reasonable and otherwise neutral statement could be possibly interpreted as trolling, but knock yourself out. –  Feb 14 '18 at 16:27
  • 1
    Can you show your "research"? Please point to an open issue. You keep mentioning that there's all of these problems out there but refuse to actually share concrete information about it. The issues [here](https://github.com/JuliaLang/IJulia.jl/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+pyplot) don't show plotting rendering issues with Plots+PyPlot. [The Plots.jl page](https://github.com/JuliaPlots/Plots.jl/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+IJulia+PyPlot) has one rendering issue [which comes from a non-standard installation](https://github.com/JuliaPlots/Plots.jl/issues/1222). – Chris Rackauckas Feb 14 '18 at 16:33
  • I am sorry I thought you were trolling because what you're referencing doesn't seem to exist in the issues of the relevant repositories. That, coupled with your insistence of not actually sharing where you're getting this from, caused me to believe that you were purposely being malicious for whatever reason (which does happen all the time with open source). However, please prove me wrong and alert me of a related issue, I would be happy to take a look at it. Maybe we can find a solution if we know about the issue! – Chris Rackauckas Feb 14 '18 at 16:35
  • 2
    @PaulH the docs have been updated so it's more clear that PyPlot is interactive. Hope that helps. – Chris Rackauckas Feb 14 '18 at 16:44

1 Answers1

3

The simple plot(...) command will open an interactive window when used from the REPL when using the PyPlot backend. All you have to do is choose that backend, for example:

using Plots
pyplot() # backend choice
plot(rand(10,10))

For IDEs like Juno or VSCode that have a plot window, a PNG is displayed by default but you can open up the interactive window via the gui() command. In IJulia static PNGs are displayed, and currently the gui command is disabled there and so until that's re-enabled I'd recommend the REPL for interactive plots from PyPlot.

Chris Rackauckas
  • 18,645
  • 3
  • 50
  • 81