Skip to contents

Generate automatic plots for objects generated in biometryassist

Usage

autoplot(object, ...)

# S3 method for mct
autoplot(
  object,
  size = 4,
  label_height = 0.1,
  rotation = 0,
  axis_rotation = rotation,
  label_rotation = rotation,
  ...
)

# S3 method for design
autoplot(
  object,
  rotation = 0,
  size = 4,
  margin = FALSE,
  palette = "default",
  buffer = NULL,
  row = NULL,
  column = NULL,
  block = NULL,
  treatments = NULL,
  ...
)

Arguments

object

An object to create a plot for. Currently objects from the multiple_comparisons() or design() functions with class "mct" or "design" respectively are supported.

...

Arguments passed to methods.

size

Increase or decrease the text size within the plot for treatment labels. Numeric with default value of 4.

label_height

Height of the text labels above the upper error bar on the plot. Default is 0.1 (10%) of the difference between upper and lower error bars above the top error bar. Values > 1 are interpreted as the actual value above the upper error bar.

rotation

Rotate the x axis labels and the treatment group labels within the plot. Allows for easier reading of long axis or treatment labels. Number between 0 and 360 (inclusive) - default 0

axis_rotation

Enables rotation of the x axis independently of the group labels within the plot.

label_rotation

Enables rotation of the treatment group labels independently of the x axis labels within the plot.

margin

Logical (default FALSE). A value of FALSE will expand the plot to the edges of the plotting area i.e. remove white space between plot and axes.

palette

A string specifying the colour scheme to use for plotting. Default is equivalent to "Spectral". Colour blind friendly palettes can also be provided via options "colour blind" (or "color blind", both equivalent to "viridis"), "magma", "inferno", "plasma" or "cividis". Other palettes from scales::brewer_pal() are also possible.

buffer

A string specifying the buffer plots to include for plotting. Default is NULL (no buffers plotted). Other options are "edge" (outer edge of trial area), "rows" (between rows), "columns" (between columns), "double row" (a buffer row each side of a treatment row) or "double column" (a buffer row each side of a treatment column). "blocks" (a buffer around each treatment block) will be implemented in a future release.

row

A variable to plot a column from object as rows.

column

A variable to plot a column from object as columns.

block

A variable to plot a column from object as blocks.

treatments

A variable to plot a column from object as treatments.

Value

A ggplot2 object.

Examples

dat.aov <- aov(Petal.Width ~ Species, data = iris)
output <- multiple_comparisons(dat.aov, classify = "Species")
autoplot(output, label_height = 0.5)

des.out <- design(type = "crd", treatments = c(1, 5, 10, 20),
                  reps = 5, nrows = 4, ncols = 5, seed = 42, plot = FALSE)
#> Source of Variation                     df
#>  =============================================
#>  treatments                              3
#>  Residual                                16
#>  =============================================
#>  Total                                   19
autoplot(des.out)


# Colour blind friendly colours
autoplot(des.out, palette = "colour-blind")


# Alternative colour scheme
autoplot(des.out, palette = "plasma")