Skip to content

How to display a Scene in a jupyter python notebook (using Makie with PyCall) #2217

Answered by gyndlf
ea42gh asked this question in Q&A
Discussion options

You must be logged in to vote

Like @asinghvi17 mentioned, using JuliaCall fixes this issue. The following code works in an Ipython notebook

from juliacall import Main as jl

# Install the Makie package. This only needs to be run once
import juliapkg
juliapkg.add("CairoMakie", uuid="13f3f980-e62b-5c42-98c6-ff1f3baf88f0")

# Import CairoMakie into the Julia session
jl.seval("using CairoMakie")

import numpy as np
x = np.linspace(0.1, 10, 30)
f = lambda x: x**2 * np.sin(x + 1/x)
y = f(x)

fig, ax, lns = jl.lines(x, y, label="Simple function")
jl.axislegend(position=jl.seval(':lt'))
fig

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@ea42gh
Comment options

@asinghvi17
Comment options

@gyndlf
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by asinghvi17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants