1. Attributes with 15 entries:
    2. color => RGBA{Float32}(0.0,0.447059,0.698039,1.0)
    3. colormap => viridis
    4. colorrange => Automatic()
    5. cycle => [:color]
    6. inspectable => true
    7. linestyle => nothing
    8. linewidth => 1.5
    9. marker => circle
    10. markercolor => Automatic()
    11. markercolormap => viridis
    12. markercolorrange => Automatic()
    13. markersize => 12
    14. strokecolor => black
    15. strokewidth => 0

    Or as a Dict calling pltobj.attributes.attributes.

    Asking for help in the REPL as ?lines or help(lines) for any given plotting function will show you their corresponding attributes plus a short description on how to use that specific function. For example, for lines:

    1. help(lines)

    Not only the plot objects have attributes, also the Axis and Figure objects do. For example, for Figure, we have backgroundcolor, resolution, and fontsize as well as the figure_padding which changes the amount of space around the figure content, see the grey area in Figure 5. It can take one number for all sides, or a tuple of four numbers for left, right, bottom and top.

    Axis has a lot more, some of them are backgroundcolor, xgridcolor and title. For a full list just type help(Axis).

    Hence, for our next plot we will call several attributes at once as follows:

    1. lines(1:10, (1:10).^2; color=:black, linewidth=2, linestyle=:dash,
    2. figure=(; figure_padding=5, resolution=(600, 400), font="sans",
    3. backgroundcolor=:grey90, fontsize=16),
    4. axis=(; xlabel="x", ylabel="x²", title="title",
    5. xgridstyle=:dash, ygridstyle=:dash))
    6. current_figure()

    Figure 5: Custom plot.

    This example has already most of the attributes that most users will normally use. Probably, a legend will also be good to have. Which for more than one function will make more sense. So, let’s append another mutation plot object and add the corresponding legends by calling axislegend. This will collect all the labels you might have passed to your plotting functions and by default will be located in the right top position. For a different one, the position=:ct argument is called, where :ct means let’s put our label in the center and at the top, see Figure Figure :

    1. lines(1:10, (1:10).^2; label="x²", linewidth=2, linestyle=nothing,
    2. figure=(; figure_padding=5, resolution=(600, 400), font="sans",
    3. backgroundcolor=:grey90, fontsize=16),
    4. axis=(; xlabel="x", title="title", xgridstyle=:dash,
    5. scatterlines!(1:10, (10:-1:1).^2; label="Reverse(x)²")
    6. current_figure()

    Figure 6: Custom plot legend.

    Other positions are also available by combining left(l), center(c), right(r) and bottom(b), center(c), top(t). For instance, for left top, use :lt.

    However, having to write this much code just for two lines is cumbersome. So, if you plan on doing a lot of plots with the same general aesthetics, then setting a theme will be better. We can do this with set_theme!() as the following example illustrates.

    Plotting the previous figure should take the new default settings defined by set_theme!(kwargs):

    Figure 7: Set theme example.

    Note that the last line is set_theme!(), which will reset to the default settings of Makie. For more on themes please go to Section 6.3.

    Before moving on into the next section, it’s worthwhile to see an example where an array of attributes is passed at once to a plotting function. For this example, we will use the scatter plotting function to do a bubble plot.

    The data for this could be an array with 100 rows and 3 columns, which we generated at random from a normal distribution. Here, the first column could be the positions in the x axis, the second one the positions in y and the third one an intrinsic associated value for each point. The latter could be represented in a plot by a different color or with a different marker size. In a bubble plot we can do both.

    1. using Random: seed!
    2. seed!(28)
    3. xyvals = randn(100, 3)
    4. xyvals[1:5, :]
    1. 5×3 Matrix{Float64}:
    2. 0.550992 1.27614 -0.659886
    3. -1.06587 -0.0287242 0.175126
    4. -0.721591 -1.84423 0.121052
    5. 0.801169 0.862781 -0.221599
    6. -0.340826 0.0589894 -1.76359

    Next, the corresponding plot can be seen in Figure :

    Figure 8: Bubble plot.

    where we have decomposed the tuple FigureAxisPlot into fig, ax, pltobj, in order to be able to add a Legend and Colorbar outside of the plotted object. We will discuss layout options in more detail in Section 6.6.

    We have done some basic but still interesting examples to show how to use Makie.jl and by now you might be wondering: what else can we do? What are all the possible plotting functions available in Makie.jl? To answer this question, a CHEAT SHEET is shown in Figure . These work especially well with backend.

    Figure 9: Plotting functions: CHEAT SHEET. Output given by CairoMakie.

    Figure 9: Plotting functions: CHEAT SHEET. Output given by CairoMakie.

    For completeness, in Figure 10, we show the corresponding functions CHEAT SHEET for GLMakie.jl, which supports mostly 3D plots. Those will be explained in detail in Section .

    Figure 10: Plotting functions: CHEAT SHEET. Output given by GLMakie.

    Now, that we have an idea of all the things we can do, let’s go back and continue with the basics. It’s time to learn how to change the general appearance of our plots.