publish: Publication ready theme

View source: R/publish.R

publishR Documentation

Publication ready theme

Description

Create a publication ready theme based on the ggpubr() package. The publish() function is a customized version of theme_bw() adjusted to my personal preference.

Usage

publish(
  base_size = 12,
  base_family = "sans",
  border = TRUE,
  margin = TRUE,
  legend = c("right", "top", "bottom", "left", "none"),
  x.text.angle = 0,
  flip = FALSE,
  major_grid = TRUE,
  minor_grid = FALSE,
  facet_fill = "grey75",
  facet_color = NA,
  facet_text_color = "white",
  base_line_size = 0.5,
  base_rect_size = 1,
  aspect.ratio = 1
)

Arguments

base_size

base font size

base_family

base font family

border

logical value. Default is TRUE. If TRUE, add panel border.

margin

logical value. Default is TRUE. If FALSE, reduce plot margin.

legend

character specifying legend position. Allowed values are one of c("top", "bottom", "left", "right", "none"). Default is "top" side position. to remove the legend use legend = "none". Legend position can be also specified using a numeric vector c(x, y). In this case it is possible to position the legend inside the plotting area. x and y are the coordinates of the legend box. Their values should be between 0 and 1. c(0,0) corresponds to the "bottom left" and c(1,1) corresponds to the "top right" position. For instance use legend = c(0.8, 0.2).

x.text.angle

Rotation angle of x axis tick labels. Default value is 0. Use 90 for vertical text.

flip

logical. If TRUE, grid lines are added to y axis instead of x axis.

major_grid

logical. If TRUE, major grid lines are added.

minor_grid

logical. If TRUE, minor grid lines are added.

facet_fill

fill color for facet strips. Defaults to "grey75".

facet_color

border color for facet strips. Defaults to "NA".

facet_text_color

text color for facet strips. Defaults to "white".

base_line_size

numerical. Specifies the default element_line() size for plots. Defaults to 0.5.

base_rect_size

numerical. Specifies the default line size for element_rect() in plots. Defaults to 1.

aspect.ratio

numerical. Specifies the aspect ratio of the plot.

Examples

p <- ggplot(mtcars, aes(x = wt, y = mpg)) +
  geom_point(aes(color = gear))

# Default plot
p

# Use publish()
p + publish()


jrijn/streamlineR documentation built on July 4, 2025, 12:09 p.m.