diff --git a/docs/gallery/gallery/customization/figure.jl b/docs/gallery/gallery/customization/figure.jl index a0a600b32..3f828df25 100644 --- a/docs/gallery/gallery/customization/figure.jl +++ b/docs/gallery/gallery/customization/figure.jl @@ -8,16 +8,56 @@ using AlgebraOfGraphics, CairoMakie set_aog_theme!() #src -# To tweak figure attributes, simply use the `figure` keyword when plotting. For example +# You can pass attributes to the underlying `Makie.Figure` using the `figure` keyword of [`draw`](@ref). df = (x=rand(100), y=rand(100), z=rand(100), c=rand(["a", "b"], 100)) xyc = data(df) * mapping(:x, :y, layout=:c) layers = linear() + mapping(color=:z) plt = xyc * layers +draw( + plt, + figure = (; + figure_padding = 10, + backgroundcolor = :gray80, + size = (800, 400) + ) +) + +# You can also add a figure title, subtitle and footnotes. + fg = draw( plt, - axis=(aspect=1,), - figure=(figure_padding=10, backgroundcolor=:gray80, size=(800, 400)) + figure = (; + figure_padding = 10, + backgroundcolor = :gray80, + size = (800, 400), + title = "Figure title", + subtitle = "Some subtitle below the figure title", + footnotes = [ + rich(superscript("1"), "First footnote"), + rich(superscript("2"), "Second footnote"), + ] + ) +) + +# The appearance of these elements can be modified further, for all options check the [`draw`](@ref) function. + +draw( + plt, + figure = (; + figure_padding = 10, + backgroundcolor = :gray80, + size = (800, 400), + title = "Figure title", + subtitle = "Some subtitle below the figure title", + footnotes = [ + rich(superscript("1"), "First footnote"), + rich(superscript("2"), "Second footnote"), + ], + titlecolor = :firebrick, + titlealign = :right, + footnotefont = :bold, + ) ) # save cover image #src