make.autograph: make.autograph - Creates plots using ggplot2

Description Usage Arguments Author(s) Examples

View source: R/make.autograph.R

Description

This function allows you to generate quantitative plots of your data. Creates scatter plots. If interested in generating other plots (bar graphs) or adding statistics, we recommend reading more on using 'ggplot2' (for more info https://ggplot2.tidyverse.org/). Uses the package 'ggplot2' to generate plots, 'data.table' to manipulate data.

Usage

1
make.autograph(dat, x.axis, y.axis, colour.by, colours, y.axis.label, grp.order, title, filename, scale, dot.size, width, height, path)

Arguments

dat

NO DEFAULT. data.frame.

x.axis

NO DEFAULT. Character or numeric. Selects column that will specify x-axis.

y.axis

NO DEFAULT. Character or numeric. Selects column that will specify y-axis.

colour.by

DEFAULT = x.axis. Character, column name. Selects column that will determine differentiator of colour in plots.

y.axis.label

NO DEFAULT. Character. Specify y-axis label. Can be "" if one is not desired.

grp.order

DEFAULT = NULL. String of characters or numbers. Specify order of group for x-axis.

colours

DEFAULT = NULL. String of characters. Will determine the colours that will differentiate between colours specified by 'colour.by'.

my_comparisons

DEFAULT = NULL. A list containing vectors – each a pair of groups for comparison.

Variance_test

DEFAULT = NULL. Can be 'wilcox.test' (non-parametric) or 't.test' (parametric)

Pairwise_test

DEFAULT = NULL. Can be 'kruskal.test' (non-parametric) or 'anova' (parametric)

title

DEFAULT = paste0(y.axis.label, " - ", y.axis). Character. Specify title of plot on graph. Default combines 'y.axis.label' and 'y.axis'.

subtitle

DEFAULT = NULL. Plot subtitle.

filename

DEFAULT = paste0(y.axis.label, " - ", y.axis, ".pdf"). Character. Specify name plot will be exported as. Default combines 'y.axis.label' and 'y.axis'. Make sure to end with ".pdf" so file is correctly saved.

violin

DEFAULT = TRUE. Add violin plot underneath the data points.

scale

DEFAULT = "lin". Character. Select y-axis scale. Can also be "sci".

dot.size

DEFAULT = 5. Numeric. Specify size of dots on plot.

width

DEFAULT = 5. Numeric. Specify width of plot.

height

DEFAULT = 5. Numeric. Specify height of plot.

max.y

DEFAULT = 1.4. Multiplier for plot heigh – allowing room for stats.

path

DEFAULT = getwd(). The location to save plots. By default, will save to current working directory. Can be overidden.

Author(s)

Thomas M Ashhurst, thomas.ashhurst@sydney.edu.au Felix Marsh-Wakefield, felix.marsh-wakefield@sydney.edu.au

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
dat <- data.frame(Samples = c("Mock_01", "Mock_02", "Mock_03", "WNV_01", "WNV_02", "WNV_03"),
                  Group = c(rep("Mock", 3), rep("WNV", 3)),
                  Tcells = c(20, 40, 30, 60, 70, 80),
                  Bcells = c(90, 95, 70, 20, 15, 30),
                  Batch = c(1,2,1,3,2,1)
                  )

Spectre::make.autograph(dat = dat,
                        x.axis = "Group",
                        y.axis = "Tcells",
                        colour.by = "Batch",
                        colours = c("Black", "Red", "Blue"),
                        y.axis.label = "Proportion"
                        )

sydneycytometry/Spectre documentation built on March 20, 2021, 2:15 a.m.