Allow for customization of showAreaAndBarPlots and showLinePlots#143
Merged
Conversation
codeZeilen
approved these changes
Jan 20, 2026
codeZeilen
approved these changes
Jan 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Sometimes, we want to add customization to the objects returned by the show functions
showAreaAndBarPlotsandshowLinePlots. This is why the creation and rendering of plots was split into separate functions (#138). ForcreateAreaAndBarPlotsandcreateLinePlots, the returned objects aregtableobjects, which are still hard to manipulate.Changes
This PR introduces intermediate steps
layoutLinePlotsandlayoutAreaAndBarPlots, 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 returnsgtableobjects. 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