Ipynb Files - Makie Result displayed in separate Window

Under Windows in VSCode I have an ipynb file
In this is a small demo code for Makie.

using GLMakie
x = 1:40:360
fig = lines(x, x.^7; label = "Parabola",
    axis = (; xlabel = "x", ylabel = "y", title ="Title"),
    linestyle = :dashdot,
    figure = (; resolution = (1200,800), fontsize = 22))
axislegend(; position = :lt)
fig

When I execute the cell, the result sometimes appears below the cell as an image and sometimes as an extra window which is then also interactive.
But I couldn’t figure out how to consciously control where the output takes place.

Who can help me with this please?

Sometimes as in randomly inline or windowed display?

yes, exactly like that. It changes from time to time

@sdanisch

You should be able to control that via Makie.inline(true/false).
If youre switching between backends, you can also make the value stick for a particular backend:
GLMakie.activate!(inline=false)

1 Like

This is very helpful, although it doesn’t explain why (if you don’t use GLMakie.activate!(inline=false/true)) this changing behavior sometimes happens.

While I have you on the line:
something else that doesn’t directly belong to this topic but still seems worth asking:

if in the REPL a query for ?lines! comes always only the help for ?lines.

An excerpt from the help text:

 lines(positions)
  lines(x, y)
  lines(x, y, z)

But the important info for the possible integration of “Axis” like lines!(ax, x, y, linewidth = 9, color = y) is not mentioned there.
Couldn’t this be improved?

Of course yes!
We do have a documentation project: [Roadmap] Documentation · Issue #3105 · MakieOrg/Makie.jl · GitHub for that.
But it’s not clear when the work on that will start.
Meanwhile, you can always open a PR to improve the current docstrings!

this changing behavior sometimes happens.

Not sure either, but it is a global, so maybe something changes that global.
E.g. loading a backend could change it, but re-activating the backend should bring back the the previous inline behaviour!

using GLMakie # has inline false as default
using CairoMakie # changes global to inline!(true)
GLMakie.activate!() # should bring back inline!(false)
1 Like

Thank you very much for the prompt help. I appreciate it very much