theme_grafify: A modified 'theme_classic()' for 'grafify'-like graphs.

View source: R/theme_grafify.R

theme_grafifyR Documentation

A modified theme_classic() for grafify-like graphs.

Description

This is a slightly modified theme_classic[ggplot2] with two key differences: no border & background for facet panel labels, and font size of text on axes is the same as that of the axes titles (prior to v3.2.0, this was 0.85 times the base font size). The size of text legend title is also same as base font.

Usage

theme_grafify(
  base_size = 20,
  base_family = "",
  base_line_size = base_size/22,
  base_rect_size = base_size/22,
  TextXAngle = 0,
  vjust = 0,
  hjust = 0,
  ...
)

Arguments

base_size

base font size for all text (default is 20). Other text is relative to this.

base_family

default font family

base_line_size

default line size (default is base font size/22)

base_rect_size

default size of rectangles (default is base font size/22)

TextXAngle

orientation of text on X-axis; default 0 degrees. Change to 45 or 90 to remove overlapping text.

vjust

vertical adjustment of X-axis text alignment (between 0 and 1). Set hjust and vjust to 1 if TextXAngle = 45. Try other options if using other angles.

hjust

horizontal adjustment of X-axis text alignment (between 0 and 1). Set hjust and vjust to 1 if TextXAngle = 45. Try other options if using other angles.

...

for any other arguments to pass to theme. A useful one is aspect.ratio = 1 for square plots.

Details

Since v3.2.0, theme_grafify produces transparent backgrounds.

Value

this returns an output with class "theme" and "gg".

Examples


ggplot(mpg, aes(drv, cty, colour = fl))+
geom_jitter(width = 0.2, 
size = 3, alpha = .7)+
theme_grafify()


grafify documentation built on May 29, 2024, 3:49 a.m.