Makie 3d plot cannot rotate in jupyter notebook?

Hi, I tried a Makie 3d plot sample both in REPL and jupyter notebook. REPL created a new Makie window for the plot and the plot can be rotated with mouse, however, jupyter only gave a fix pic which cannot be rotated at all.
I encountered Makie Pkg install error once, before I rm and build Makie, I got a turnable pic only once with errors, and now I rebuild all things, but all pic I got in jupyter is not turnable.
It’s that a bug or just some function not added yet?
my codes here:

using GLMakie

xs = LinRange(0, 10, 100)
ys = LinRange(0, 15, 100)
zs = [cos(x) * sin(y) for x in xs, y in ys]
fig, _ = surface(xs, ys, zs, axis=(type=Axis3,camera = cam3d!))

jupyter: win10, jupyter-notebook : 6.0.3

Update: WGLMakie also tried, gives output cannot checked in jupyter cell, may some wrong setting caused the cell size didnot fit to the pic

1 Like

Not an expert but maybe try WGLMakie instead of GLMakie.

UPDATE: Didn’t work for me in a quick check.

This is a good questions that needs an answer. Does anybody know how to do it?

Try doing:

using GLMakie

This will force GLMakie to open a separate, interactive window. With the inline result the plot will not be interactive.

Adding the Makie label to this to see if one of the devs sees it more easily and can confirm.

Did not work for me, the plot is still inline and static.

Pinging @jules to see if he knows the answer.

For me, the following works.

First you need

Then, make the last line of your notebook cell display(fig). For me, I get a Makie window which I can interact with. If instead the last line is just fig, then you get an inline, static plot.

Honestly, I cannot remember how I found this out, but it seems to give the desired result.

The reason is probably that the cell output isn’t created by calling display and capturing the output of that (which would trigger the glmakie window) but to try show methods with some mime types that the cell supports, like png, svg, etc. So without display(), you get a static image.

1 Like

Hi, I am new to julia, and I installed GLMakie in jupyter notebook, but I can’t run the code ‘using GLMakie’ because it will show error ‘invalid syntax’. How do you use the code ‘using GLMakie
GLMakie.inline!(false)’ in jupyter notebook?

What exactly did you run, the code you show is valid syntax (if written on two separate lines)

I think they were trying to run using GLMakie in Python:

I want to use julia together with python, because most code for calculations is based on python. So, I import julia in python3 to plot 3D data based on the calculation results.
Can I import julia and then use Makie to make 3D plot?

I am not sure whether I can also use python in the same time.