dunno
dunno

Reputation: 205

julia notebook interactive window pyplot

How can I make my 3d plots using PyPlot interactive from Jupyter notebook?

I have a surface plot:

using PyPlot
x=1:0.1:10
y=x'
z=x.^2 + y.^2
surf(x,y,z)

but it is in a fixed window in my notebook.

Upvotes: 3

Views: 2277

Answers (1)

jjjjjj
jjjjjj

Reputation: 1172

Use: PyPlot; pygui(true) to open a standalone GUI window.

Try running %matplotlib notebook and see the output:

The analogue of IPython's %matplotlib in Julia is to use the PyPlot package, which gives a Julia interface to Matplotlib including inline plots in IJulia notebooks. (The equivalent of numpy is already loaded by default in Julia.)

Given PyPlot, the analogue of %matplotlib inline is using PyPlot, since PyPlot defaults to inline plots in IJulia.

To enable separate GUI windows in PyPlot, analogous to %matplotlib, do using PyPlot; pygui(true). To specify a particular gui backend, analogous to %matplotlib gui, you can either do using PyPlot; pygui(:gui); using PyPlot; pygui(true) (where gui is wx, qt, tk, or gtk), or you can do ENV["MPLBACKEND"]=backend; using PyPlot; pygui(true) (where backend is the name of a Matplotlib backend, like tkagg).

For more options, see the PyPlot documentation.

Upvotes: 5

Related Questions