Skip to contents

This function generates a ggplot object.

Inside ggPlot there are different function calls to ggplot2 functions in order to create a pre-defined plot.

Usage

ggPlot(
  data = NULL,
  x,
  y,
  color,
  add.violin = F,
  violin.data = NULL,
  add.boxplot = T,
  boxplot.data = NULL,
  boxplot.width = 0.1,
  add.points = T,
  point.data = NULL,
  point.shape = 16,
  point.jitter.w = 0.2,
  point.jitter.h = NULL,
  labs.title = "Plots",
  labs.x = "x",
  labs.y = "y",
  labs.col = character(),
  axis.text.x.angle = 90,
  axis.text.x.size = 9,
  axis.text.y.angle = 0,
  axis.text.y.size = 9,
  facet.rows = NULL,
  facet.cols = NULL,
  ...
)

Arguments

data

data.frame containing the data to plot

x, y, color

character string, columns in data describing which variables should be mapped to the aesthetics x, y, and color in ggplot

add.violin

logical, whether to include a violin plot in the figure

violin.data, boxplot.data, point.data

data.frame containing the data to be displayed in the respective layers. If NULL, the data is inherited from data

add.boxplot

logical, whether to include a boxplot in the figure

boxplot.width

numeric, the width of boxplot

add.points

logical, whether to add the computed scores of the individual summary measures as points in the plot

point.shape

the shape to use to plot the scores. It can take five types of values:

  • An integer in `[0, 25]`

  • The name of the shape

  • A single character, used as a plotting symbol

  • A . to draw the smallest rectangle that is visible, usually 1 pixel

  • An NA, to draw nothing

See vignette("ggplot2-specs") for further details

point.jitter.w, point.jitter.h

Amount of vertical and horizontal jitter. The jitter is added in both positive and negative directions, so the total spread is twice the value specified here. See position_jitter for further details

labs.title

The text for the title

labs.x

The title of the x axis

labs.y

The title of the y axis

labs.col

The title of the legend

axis.text.x.angle, axis.text.y.angle

Specify the x and y axis tick labels angles (in [0, 360]) See element_text for further details

axis.text.x.size, axis.text.y.size

Specify the x and y axis tick labels size in pts. See element_text for further details

facet.rows, facet.cols

character string, variables defining the faceting groups on the rows or columns dimension. See facet_grid for further details

...

further arguments to internal function call

Value

A ggplot object.

Author

Alessandro Barberis