Skip to content

Commit

Permalink
Bring back legends (#27)
Browse files Browse the repository at this point in the history
* draft base legend

* add base legend tests

* document `guide_legend_base()`

* rename file

* text setup can take position directly

* export GuideLegendBase

* stabilise grabbing attributes

* implement `guide_legend_cross()`

* add tests for cross legend

* replace `dim_order` by `swap`

* document cross legend

* draft `key_split_group`

* lut key

* add lut group test

* small utility

* reintroduce guide_legend_group

* add group legend tests

* add `legendry.group.spacing` as element

* small tweaks

* document
  • Loading branch information
teunbrand authored Oct 26, 2024
1 parent 692639e commit cc01027
Show file tree
Hide file tree
Showing 52 changed files with 3,843 additions and 34 deletions.
7 changes: 7 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export(GizmoGrob)
export(GizmoHistogram)
export(GizmoStepcap)
export(GuideColring)
export(GuideLegendBase)
export(GuideLegendGroup)
export(PrimitiveBox)
export(PrimitiveBracket)
export(PrimitiveFence)
Expand Down Expand Up @@ -45,8 +47,13 @@ export(guide_axis_nested)
export(guide_colbar)
export(guide_colring)
export(guide_colsteps)
export(guide_legend_base)
export(guide_legend_cross)
export(guide_legend_group)
export(key_auto)
export(key_bins)
export(key_group_lut)
export(key_group_split)
export(key_log)
export(key_manual)
export(key_map)
Expand Down
4 changes: 2 additions & 2 deletions R/compose-crux.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ ComposeCrux <- ggproto(
),

setup_elements = function(params, elements, theme) {
elements$title <- setup_legend_title(theme, params$direction)
elements$title <- setup_legend_title(theme, direction = params$direction)
theme <- theme + params$theme
Guide$setup_elements(params, elements, theme)
},
Expand Down Expand Up @@ -204,7 +204,7 @@ ComposeCrux <- ggproto(
gt,
title = self$build_title(params$title, elems, params),
position = elems$title_position,
with(elems$title, rotate_just(angle, hjust, vjust))
get_just(elems$title)
)
if (!is.null(elems$margin)) {
gt <- gtable_add_padding(gt, elems$margin)
Expand Down
Loading

0 comments on commit cc01027

Please sign in to comment.