quinnj / Sublime-IJulia

An IJulia Frontend for Sublime Text 3
90 stars 16 forks source link

Open plot in a new sublime view #37

Open quinnj opened 10 years ago

quinnj commented 10 years ago

This is up for grabs if anyone feels willing to take it on. I just don't have the time right now. See this thread for more discussion.

https://groups.google.com/forum/m/#!searchin/julia-users/sublime/julia-users/-W4LiTtVeAE

cbecker commented 10 years ago

Does this have to do with opening PyPlot plots? For me it works out to do PyPlot.pygui(true) before plotting, then everything works like a charm.

quinnj commented 10 years ago

But that probably opens up the plot in a separate window, right? With the newest release of sublime, you can actually open images in a new view in sublime, so it's a little more "inline" (and hopefully it'll be true inline soon). This would involve correctly handling the "display_data" tag returned by the IJulia kernel when a request ot plot was made.

cbecker commented 10 years ago

yes, that opens it in a new window. I didn't know that the inline capability would be possible, sounds very good indeed.

quinnj commented 10 years ago

Updated the issue to be more clear. Yeah, I knew it was possible to open up new windows with plots if the plotting package supports that, but the next step is doing it all within sublime.

natj commented 10 years ago

At least Winston is capable of producing png-figures straight away so this should be doable. So in order for this to work one should modify the handling of display_data tag and open a new tab if png is found?

quinnj commented 10 years ago

Yep. I'm not quite sure how the .png is "returned", if it's written to disk first and the file name is returned, or if some kind of binary data is returned. That's to be figured out! I actually have skeleton methods in there already, but they just no-op for the moment.

https://github.com/karbarcca/Sublime-IJulia/blob/master/Kernel.py#L344 https://github.com/karbarcca/Sublime-IJulia/blob/master/Kernel.py#L398

The links above go to the skeleton methods that are in the code right now. We may or may not want a method in the IJulia.py IJuliaView class as well that opens up the new view.

c0g commented 10 years ago

If I do:

using PyPlot; PyPlot.pygui(true)

I get:

ERROR: No working GUI backend found for matplotlib.

I am on OSX 10.9.3.

piovac commented 10 years ago

Plotting in an external windows would be OK in the interim. the reason why pygui(true) returns the error is because Julia cannot find the path the python matplot library. I think the problems relies on the fact that julia is launched in the .app container and the environment (containing the path to python, etc.) is not loaded.

Also once julia is run inside Sublime it would be nice if the default folder is the user home. instead it is the .app container of Sublime text. In Sublime-IJulia try:

In  [2]: pwd()

Out [2]: "/Applications/Sublime Text.app/Contents/MacOS"

I'm running OSX 10.9.5, Sublime Text Build 3065, Julia 0.3.1 (as .app package, not compiled from source).

jaredlander commented 10 years ago

Any progress on this? Being able to plot either in a pane in Sublime or a popup window would be huge.

ashleylid commented 9 years ago

I am using sublime text 2 and cant get it to display plots, has this been solved and I am just not finding the answer? The PyPlot.pygui(true) does not work for me.