Skip to content

Commit

Permalink
add title, subtitle, footnotes example to figure tweaking gallery page
Browse files Browse the repository at this point in the history
  • Loading branch information
jkrumbiegel committed Sep 12, 2024
1 parent 2e2a2e2 commit 9a59c9d
Showing 1 changed file with 43 additions and 3 deletions.
46 changes: 43 additions & 3 deletions docs/gallery/gallery/customization/figure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9a59c9d

Please sign in to comment.