Skip to content

Allow for customization of showAreaAndBarPlots and showLinePlots#143

Merged
fbenke-pik merged 8 commits into
pik-piam:masterfrom
fbenke-pik:flex
Jan 20, 2026
Merged

Allow for customization of showAreaAndBarPlots and showLinePlots#143
fbenke-pik merged 8 commits into
pik-piam:masterfrom
fbenke-pik:flex

Conversation

@fbenke-pik

@fbenke-pik fbenke-pik commented Jan 16, 2026

Copy link
Copy Markdown
Contributor

Motivation

Sometimes, we want to add customization to the objects returned by the show functions showAreaAndBarPlots and showLinePlots. This is why the creation and rendering of plots was split into separate functions (#138). For createAreaAndBarPlots and createLinePlots, the returned objects are gtable objects, which are still hard to manipulate.

Changes

This PR introduces intermediate steps layoutLinePlots and layoutAreaAndBarPlots, which take care of layouting steps previously done in the create function. The create functions return a list of ggplot elements. The layout functions accept the list returned by the create function, applies layouting and returns gtable objects. The show function calls the layout function (return value is identical to previous return of the create function) and renders the result.

Other plot formats currently don't need an additional layout step, as the create functions already return a list of ggplot objects.

Usage

This PR allows for customization of ggplot objects by calling the create function in your own plotting function or in your markdown. One can make adjustments to the returned items (while maintaining the original list structure) and then can pass the modified list to the layout function.

Example

myitems <- createAreaAndBarPlots(...)

# ...
# modify myitems
# ...

showPlot(layoutAreaAndBarPlots(myitems))[1])

@fbenke-pik fbenke-pik changed the title Make showLinePlots more customizable Allow for customization of showAreaAndBarPlots and showLinePlots Jan 16, 2026
@fbenke-pik fbenke-pik marked this pull request as ready for review January 19, 2026 14:41
@fbenke-pik fbenke-pik requested a review from codeZeilen January 19, 2026 14:42
Comment thread R/showAreaAndBarPlots.R Outdated
Comment thread R/showAreaAndBarPlots.R Outdated
@fbenke-pik fbenke-pik requested a review from codeZeilen January 20, 2026 13:48
@fbenke-pik fbenke-pik merged commit a55efde into pik-piam:master Jan 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants