generate_background_chart: Generate a ggplot gtable with only background elements

View source: R/rough_convert.R

generate_background_chartR Documentation

Generate a ggplot gtable with only background elements

Description

This function copy a ggplot plot and set all its geoms to 'alpha=0'/'size=0'. 'alpha=0' makes most elements invisible. 'size=0' helps with some elements not influenced by 'alpha' like bar borders. The goal is to create a plot object with just the background elements visible.

Usage

generate_background_chart(p, family, font_size_booster)

Arguments

p

A ggplot plot

font_size_booster

A number for 'correct_font'

Details

NOTE: There are probably better way to do this but my attempts to remove geoms ended up in recalculated scales. See: https://stackoverflow.com/q/50434608/2008527

The function also include a call to 'correct_font()' which lets you apply a multiplier to all text elements font sizes.

Value

A ggplot gtable


xvrdm/ggrough documentation built on March 24, 2022, 5:42 a.m.