Open berceanu opened 10 years ago
cc: @one-more-minute; I haven't tried LT yet, so I don't have any experience with this.
PyPlot attempts to do inline plotting whenever displayable
returns true for image/png
or other supported image formats. In that case, it calls redisplay(fig)
from each plotting command.
LightTable's Display
subclass should probably overload redisplay(d, x)
to add x
to a queue of things to display (removing duplicates), and then flush the queue at the end of an input execution, similar to IJulia. See inline.jl, and the undisplay function (which is also called on the result of an input evaluation to avoid displaying the result twice).
Ok, but for starters I would settle for a separate plotting window being opened. This however does not happen.
That's because PyPlot thinks that inline display is available. You can run pygui(true)
to explicitly force a separate Python plotting window even if there is an inline display.
Looks like there was a bug in redisplay(x) that may have prevented it from working properly here.
Thanks for letting me know, I'll take a look at this.
This works now. Just call PyPlot's "figure()" method to see results inline.
import PyPlot pplt = PyPlot
x = [x/1000 * 2_pi for x=1:1000] y = sin(3_x + 4_cos(2_x)) pplt.plot(x, y, color="red", linewidth=2.0, linestyle="--") pplt.title("Sample graph") pplt.figure(1)
figure
shouldn't be necessary if redisplay
is implemented as I explained above.
LightTable has support for matplotlib inline plots, I was wondering how to get them to display using PyPlot. In fact I cannot even get it to show a separate plot window atm. I'm using LightTable with the Jewel plugin and Jupiter environment.
https://github.com/one-more-minute/Jupiter-LT