[ANN] Makie.jl 0.15

I’m happy to announce a new, minor Makie version!

The main breaking change is described in this PR.

You can find all the other important changes in the NEWS.md.

The most exciting feature surely is the much improved LaTex support, thanks to @Kolaru @jules:

using CairoMakie

f = Figure()
ax = Axis(f[1, 1])

lines!(0..10, x -> sin(3x) / (cos(x) + 2),
    label = L"\frac{\sin(3x)}{\cos(x) + 2}")
lines!(0..10, x -> sin(x^2) / (cos(sqrt(x)) + 2),
    label = L"\frac{\sin(x^2)}{\cos(\sqrt{x}) + 2}")

Legend(f[1, 2], ax)

f

The LaTeX string gets parsed into a glyph layout by MathTexEngine.jl, which doesn’t need a LaTeX install and makes it fast, fully interactive and one can can use LaTeX strings anywhere, where strings are used:

using GLMakie
lines(0..25, x -> 4 * sin(x) / (cos(3x) + 4), figure = (fontsize = 25,),
    axis = (
        xticks = (0:10:20, [L"10^{-3.5}", L"10^{-4.5}", L"10^{-5.5}"]),
        yticks = ([-1, 0, 1], [L"\sum_%$i{xy}" for i in 1:3]),
        yticklabelrotation = pi/8,
        title = L"\int_0^1{x^2}",
        xlabel = L"\sum_k{x_k ⋅ y_k}",
        ylabel = L"\int_a^b{\sqrt{abx}}"
    ),
)

latex2

Another big update is the major rework of the 3D camera by @ffreyer, which hopefully fixes quite a few quirks that came with using LScene:
http://makie.juliaplots.org/stable/cameras.html#Makie.Camera3D

Finally, @t-bltg fixed the volume slice recipe and gave it some docs, which only made it into the NEWS.md after we tagged the release (:sweat_smile: ):
volumeslices

I hope everyone has a smooth upgrade and fun with the new features!
If you encounter any issues, please report them here.

Best,
Simon

77 Likes

Minor? I would say major! Congrats! I’m completly sold obviously with the Latex Support. Here my first example. So far, everything just works!

latexSample

18 Likes

Minor?

Well, we’re still caught in pre 1.0 times :wink:

Buhut, there is actually real progress towards 1.0 happening:

12 Likes

I am impressed by a sheer beauty of your plots.

3 Likes

Congrats guys on a really nice “minor” :joy: release. The LaTeX support is awesome. Coming from a ggplot2 kind of world it’s a pleasure to use Make for scientific plotting. Well done all who contributed. :muscle:t2:

2 Likes

This is fantastic! I have recently decided to give Julia a serious try after using it on and off for some time. Among others, I have some visualization projects in mind that are sort of math-related, so the LaTeX support will come in very handy.

Also love the volume slice plot. Although I didn’t know until now I needed something like that, I think I might have some use for that as well :thinking:

1 Like

@sdanisch, thank you for the good stuff.

Two questions if you will:

  • Does the DataInspector work on the volume slices displayed above? Tried it but it seems to show only two coordinates + one data value?
  • Where can one find the list of Makie key bindings for 3D zooming, panning, resetting the zoom, etc.?
2 Likes

This is seriously cool, thanks for all of your work! I think I am running into a quick issue with the latex string in the first example. Adding an axis label with ax = Axis(f[1, 1], xlabel=L"\theta") works great, but for some reason trying:

ax.xlabel = L"\theta"

instead seems to only display $\theta$. Is this intended?

2 Likes

This is a limitation currently, if the label is a string at initialization, then the input observable of the underlying Text is parameterized String so a LatexString is just converted later.

1 Like

Agreed… as far as I’m concerned, between LaTeX support and Algebra of Graphics I have now no reasons to use any other plotting package…

Well done!

2 Likes

Does the DataInspector work on the volume slices displayed above? Tried it but it seems to show only two coordinates + one data value?

There is no specialization for volumeslices so it’ll fall back onto whatever primitive plot is used, which are heatmaps. It should be giving you two of (x, y, z) and the data value, which isn’t super useful I guess? Nvm, the heatmap inspection assumes 2D so it should be unusable.

Where can one find the list of Makie key bindings for 3D zooming, panning, resetting the zoom, etc.?

For a 3D camera in an LScene you can check ?Camera3D. The same docstring is also in the docs here.

1 Like

@ffreyer, thank you for the info on the cam3d key bindings, the controls are not intuitive (to me) and the 3D view seems very hard to tame.

Regarding the DataInspector, it would be useful at least to get the property values at the cursor point. When hovering the cursor over the bounding 3D box we get proper (x,y,z) coordinates.

1 Like

the controls are not intuitive (to me) and the 3D view seems very hard to tame.

I think that’s just kind of a general thing. You have 3 rotation axes, 3 translation directions and zooming, each going two ways - that’s a lot to deal with. The mouse controls should be mostly the same as before, with the exception that zooming now uses fov instead squeezing the view box (which causes clipping issues). I feel like it’s easier to get lost with that, so I’m not sure if it was a good change…

The keyboard controls are all new and allow you some things you couldn’t do before, i.e. rotating the screen with q/e and moving in and out with w/s. Another new thing here is fixing of rotation/translation axes with x/y/z which should be helpful taming things.

You might also find it easier to use Camera3D(lscene.scene), which changes some defaults. (No fixed z axis, no translation during zooming)

1 Like

Thanks.
For whatever it is worth, this online 3D viewer provides a more intuitive zooming using the mouse and keyboard (could not find a better example right now).

3 Likes

Ah, I see. Thanks for the quick response!

When installing Makie here, I keep getting the 0.13.14 version. What may be holding me back?

Try ]add Makie@0.15 to find out :wink:

1 Like

Thanks, it was FloatingTableView.jl. I reported the issue in their repo.

edit: Now, if I run this example:

using CairoMakie

x = range(0, 10, length=100)
y1 = sin.(x)
y2 = cos.(x)

scatter(x, y1, color = :red, markersize = range(5, 15, length=100))
sc = scatter!(x, y2, color = range(0, 1, length=100), colormap = :thermal)

current_figure()

Instead of getting a plot I get:

julia> current_figure()
Scene (800px, 600px):
  18 Plots:
    ├ Combined{Makie.poly, Tuple{Vector{Vector{Point{2, Float32}}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ MakieCore.Text{Tuple{String}}
    ├ Lines{Tuple{Vector{Point{2, Float32}}}}
    ├ MakieCore.Text{Tuple{Vector{Tuple{AbstractString, Point{2, Float32}}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ MakieCore.Text{Tuple{String}}
    ├ Lines{Tuple{Vector{Point{2, Float32}}}}
    ├ MakieCore.Text{Tuple{Vector{Tuple{AbstractString, Point{2, Float32}}}}}
    ├ Lines{Tuple{Vector{Point{2, Float32}}}}
    ├ Lines{Tuple{Vector{Point{2, Float32}}}}
    └ MakieCore.Text{Tuple{String}}
  1 Child Scene:
    └ Scene (728px, 541px)

Any idea on what may be wrong here?

1 Like

For CairoMakie, you need to have an active display system that can show images, e.g. VSCode with active plotpane, or Pluto.
Otherwise, you’ll need to use save("test.png", current_figure())

2 Likes

I’m also struggling with the new 3D camera controls. Particularly the zoom on a Mac touchpad. I know from experience that creating intuitive 3D camera controls is very challenging, and there is no one size fits all solution. This is why 3D editing programs often have multiple camera control modes that you can select from.

For touch interfaces, I really like ArcBall style controls, the cursor position and the screen projected ball position move together. I guess you can copy the threeJS implementation. It’s demoed here Arcball Control for threejs - YouTube.

Regarding the keyboard navigation, that’s really cool. Is there a way to also map the more standard arrow keys in addition to the WASD controls. I think non-gamers might simply not realise that keyboard navigation is possible.

1 Like