As an example we will code a small full recipe for a DataFrame
. Please refer to the documentation for more details.
A Makie recipe
consist of two parts, a plot name defined via @recipe
and a custom plot!(::Makie.plot)
which creates the actual plot via plotting functions already defined.
Note that the macro @recipe
will automatically create two new functions for us, dfplot
and dfplot!
, all lowercase from our type DfPlot
. The first one will create a complete new figure whereas the second one will plot into the current axis or an axis of your choosing. This allows us to plot DataFrame
s which contains columns named, , y
, z
. Now, let’s take care of our plot definition. We will do a simple scatter plot:
Figure 47: DataFrames recipe.
The named attributes in the recipe allows us to pass custom names to our new plotting function. Namely:
Figure 48: DataFrames recipe with arguments.
Note, that now we are calling by name each column as well as the marker type, allowing us to use this definition for different DataFrames. Additionally, all our previous options, i.e., or figure
also work!