I’ve looked at the Plots documentation and it seems like the recipes are a good way to define a “default plotting style” that is highly customizable based on input.
My intention is to write a recipe that allows me to plot a StatsBase histogram with some default parameters, so pretty much “Call the recipe that get’s called when I use plot(histogram) to handle the data but use my plot attributes / overwrite them with mine”.
Looking at both the Plots.jl and RecipesBase.jl I’m somewhat unsure on what recipe type is the correct choice / their limits.
A Plot Recipe seems like it should be able to do what I want though the (from RecipesBase)
" Plot recipes define a new series type. They are applied after type recipes. Hence, standard Plots types can be assumed for input data :x
, :y
and :z
in plotattributes
. Plot recipes can access plot and subplot attributes before they are processed"
part and the initial x,y=… makes me wonder if “standard” recipes include those from StatsBase and in general I don’t understand how the input (or if it works?) for something like the histogram since it’s different to just handing over a vector (or two) that could be assigned as x or y.
The examples I found in the docs and through google always are either too complex for me to understand the idea / how it works (like the marginalhist
one from the documentation) and always handle either “Here is my new example type that’s structured that way so I want it to get processed like this…” or “I have this datatype and I want Plots to handle it like type X”.
Which would mean that I would have to copy the base recipe and tweak parts of it, which seems more like the brute force way to do it and makes my recipe less readable and understandable (to myself and others)…
So I appreciate any input and potential guidance in terms of examples that can help me understand recipes in general a bit more