View source: R/theme_minimal_white.R
theme_minimal_white | R Documentation |
This function extends ggplot2::theme_minimal()
by ensuring a white background
(preventing gray backgrounds when exporting to PNG) and providing options for customizing
axis lines, grid visibility, axis ticks, and borders.
theme_minimal_white(
base_size = 11,
base_family = "",
base_line_size = base_size/22,
base_rect_size = base_size/22,
base_col = "#323232",
axis_text_family = base_family,
axis_text_size = base_size,
axis_title_family = base_family,
axis_title_size = base_size,
axis_title_face = "plain",
axis_title_just = "mc",
axis_col = base_col,
grid = TRUE,
axis = FALSE,
ticks = FALSE,
border = FALSE
)
base_size |
Numeric. Base font size (default: 11). |
base_family |
Character. Base font family (default: ""). |
base_line_size |
Numeric. Base line size relative to 'base_size' (default: 'base_size / 22'). |
base_rect_size |
Numeric. Base rectangle size relative to 'base_size' (default: 'base_size / 22'). |
base_col |
Character. Base text color (default: '"#323232"'). |
axis_text_family |
Character. Font family for axis text (default: 'base_family'). |
axis_text_size |
Numeric. Font size for axis text (default: 'base_size'). |
axis_title_family |
Character. Font family for axis titles (default: 'base_family'). |
axis_title_size |
Numeric. Font size for axis titles (default: 'base_size'). |
axis_title_face |
Character. Font face for axis titles (default: '"plain"'). |
axis_title_just |
Character. Axis title justification. One of '[blmcrt]' (default: '"mc"'). |
axis_col |
Character. Color for axis lines and text (default: 'base_col'). |
grid |
Logical or Character. Controls the visibility of grid lines:
|
axis |
Logical or Character. Controls axis lines:
|
ticks |
Logical. Whether to show axis ticks (default: 'FALSE'). |
border |
Logical. Whether to add a panel border around the plot (default: 'FALSE').
If |
A ggplot2
theme object with a white plot background and customizable
grid, axis, tick, and border settings.
library(ggplot2)
base_plot <- ggplot(mtcars,
aes(x = mpg,
y = wt)) +
geom_point()
base_plot
base_plot +
theme_minimal_white()
base_plot +
theme_minimal_white(grid = "XY")
base_plot +
theme_minimal_white(axis = "X")
base_plot +
theme_minimal_white(border = TRUE)
base_plot +
theme_minimal_white(grid = FALSE,
border = TRUE,
ticks = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.