Skip to contents

Change the ggplot2-based theme in order to meet the needs of graph (such as EPR spectrum, kinetic profiles...etc) visuals/non-data components of the actual plot. Theme can be mainly applied for the basic ggplot2 components like ggplot() + geom_...() + ... and consists of highlighted panel borders, grid and axis ticks pointing inside the graph/plot panel. For details of ggplot2 theme elements please, refer to Modify Components of a Theme (see also the theme) or to ggplot2 Elements Demonstration by Henry Wang.

Usage

plot_theme_In_ticks(
  axis.text.size = 14,
  axis.title.size = 15,
  grid = TRUE,
  border.line.color = "black",
  border.line.type = 1,
  border.line.width = 0.5,
  bg.transparent = FALSE,
  ...
)

Arguments

axis.text.size

Numeric, text size (in pt) for the axes units/descriptions, default: axis.text.size = 14.

axis.title.size

Numeric, text size (in pt) for the axes title, default: axis.title.size = 15.

grid

Logical, whether to display the grid within the plot/graph panel, default: grid = TRUE.

border.line.color

Character string, setting up the color of the plot panel border line, default: border.line.color = "black".

border.line.type

Character string or integer, corresponding to width of the graph/plot panel border line. Following types can be specified: 0 = "blank", 1 = "solid" (default), 2 = "dashed", 3 = "dotted", 4 = "dotdash", 5 = "longdash" and 6 = "twodash"..

border.line.width

Numeric, width (in mm) of the plot panel border line, default: border.line.width = 0.5.

bg.transparent

Logical, whether the entire plot background (excluding the panel) should be transparent, default: bg.transparent = FALSE, i.e. no transparent background.

...

additional arguments specified by the theme (such as panel.backgroud, axis.line,...etc), which are not specified otherwise.

Value

Custom ggplot2 theme (list) with x,y-axis ticks pointing inside the graph/plot panel.

Examples

## loading the aminoxyl radical CW EPR spectrum:
aminoxyl.data.path <-
  load_data_example(file = "Aminoxyl_radical_a.txt")
aminoxyl.data <-
  readEPR_Exp_Specs(aminoxyl.data.path,
                    qValue = 2100)
#
## simple `ggplot2` without any theme customization
ggplot2::ggplot(data = aminoxyl.data) +
  ggplot2::geom_line(
  ggplot2::aes(x = B_mT,y = dIepr_over_dB)
  )

#
## simple `ggplot2` with `in-ticks` theme and tile
ggplot2::ggplot(data = aminoxyl.data) +
  ggplot2::geom_line(
    ggplot2::aes(x = B_mT,y = dIepr_over_dB)
    ) +
  plot_theme_In_ticks() +
  ggplot2::ggtitle(
  label = "EPR Spectrum of Aminoxyl Radical"
  )

#
## basic EPR spectrum plot by the `plot_EPR_Specs()`
plot_EPR_Specs(data.spectra = aminoxyl.data)

#
## previous spectrum combined with `in-ticks` theme
## without the panel background
plot_EPR_Specs(data.spectra = aminoxyl.data) +
  plot_theme_In_ticks(
    panel.background = ggplot2::element_blank()
    )