6.1 CairoMakie.jl

Let’s start with our first plot: some scatter points with a line across them. Remember, first we call the backend and activate it, namely

using CairoMakie
CairoMakie.activate!()

And then the plotting function, in this case scatterlines(x,y) for points x=1:10 and y=1:10:

fig = scatterlines(1:10, 1:10)
Figure 4: First plot.

Note that the previous plot is the default output, which we probably need to tweak by using axis names and labels.

Every plotting function like scatterlines creates and returns a new Figure, Axis and plot object in a collection called FigureAxisPlot. These are known as the non-mutating methods. On the other hand, the mutating methods (e.g. scatterlines!, note the !) just return a plot object which can be appended into a given axis or the current_axis().

The next question that one might have is: how do I change the color or the marker type? This can be done via attributes, which we do in the next section.



Support this project
CC BY-NC-SA 4.0 Jose Storopoli, Rik Huijzer, Lazaro Alonso