Skip to contents

This function creates a customised theme for ggplot2 plots. It modifies various elements of the default theme_classic() to provide a specific style.

Usage

hgps_theme()

Value

A ggplot2 theme object with customised settings for plot title, axis titles, axis text, legend text, legend title, major grid lines, legend key background, and legend position.

Details

The hgps_theme function modifies the following elements of the classic theme:

  • plot.title: Sets the font size of the plot title (default is 15).

  • axis.title.x: Sets the font size of the x-axis title (default is 10).

  • axis.title.y: Sets the font size of the y-axis title (default is 10).

  • axis.text.x: Sets the font size of the x-axis text (default is 8).

  • axis.text.y: Sets the font size of the y-axis text (default is 8).

  • legend.text: Sets the font size of the legend text (default is 8).

  • legend.title: Removes the legend title.

  • panel.grid.major.x: Adds major grid lines on the x-axis.

  • legend.key: Sets the legend key background (default is "transparent").

  • legend.position: Positions the legend (default coordinates are (0.8, 0.9)).

Examples

if (FALSE) { # \dontrun{
library(ggplot2)
ggplot(mtcars, aes(x = wt, y = mpg)) +
    geom_point() +
    hgps_theme()
} # }