Makie consists of a core package (Makie), with the plots functionalities.
In addition to this, a backend is needed to render plots into images or vector graphics. Three backends are available:
CairoMakie: vector graphics or high-quality 2D plots. Creates, but does not display plots (you need an IDE that does or you can use ElectronDisplay.jl),
GLMakie: based on OpenGL; 3D rendering and interactivity in GLFW window (no vector graphics),
WGLMakie: web version of GLMakie (plots rendered in a browser instead of a window).
Resources
Here are some links and resources useful to get started with the Makie ecosystem:
Axis(fig[2, 3]) # This is what happens if we change the layoutfig
Axis(fig3[2, 3]) # We can add another axis on fig3fig3
Axes are customizable:
fig4 =Figure()Axis(fig4[1, 1], xlabel="x label", ylabel="y label", title="Title of the plot")fig4
Plot
Finally, you can add a plot:
fig =Figure()ax =Axis(fig[1, 1])x =LinRange(-10, 10, 20)y = xscatter!(ax, x, y) # Functions with ! transform their argumentsfig
Of course, there are many plotting functions, e.g. scatterlines!:
fig =Figure()ax =Axis(fig[1, 1])x =LinRange(-10, 10, 20)y = xscatterlines!(ax, x, y) # Functions with ! transform their argumentsfig
We can also use lines!:
fig =Figure()ax =Axis(fig[1, 1])x =LinRange(-10, 10, 20)y =sin.(x) # The . means that the function is broadcast to each element of xlines!(ax, x, y)fig
Let’s add points to get a smoother line:
fig =Figure()ax =Axis(fig[1, 1])x =LinRange(-10, 10, 1000)y =sin.(x) # The . means that the function is broadcast to each element of xlines!(ax, x, y)fig
Now, you don’t have to create the Figure, Axis, and plot one at a time. You can create them at the same time with, for instance lines:
x =LinRange(-10, 10, 1000)y =sin.(x)lines(x, y) # Note the use of lines instead of lines!
Or even more simply:
x =LinRange(-10, 10, 1000)lines(x, sin)
This is a lot simpler, but it is important to understand the concepts of the Figure and Axis objects as you will need it to customize them:
CairoMakie will run without problem on the Alliance clusters. It is not designed for interactivity, so saving to file is what makes the most sense.
Example:
save("graph.png", fig)
Remember however that CairoMakie is 2D only (for now).
GLMakie
GLMakie relies on GLFW to create windows with OpenGL. GLFW doesn’t support creating contexts without an associated window. The dependency GLFW.jl will thus not install in the clusters—even with X11 forwarding—unless you use VDI nodes, VNC, or Virtual GL.
WGLMakie
You can setup a server with JSServe.jl as per the documentation. However, this method is intended for the creation of interactive widgets, e.g. for a website. While this is really cool, it isn’t optimized for performance. There might also be a way to create an SSH tunnel to your local browser, although there is no documentation on this.
The best solution probably is to save your plot to a file.
Conclusion about the Makie ecosystem on production clusters: