sp_boxplot: Generating box plot

Description Usage Arguments Value Examples

View source: R/sp_boxplot.R

Description

metadata

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
sp_boxplot(
  data,
  melted = FALSE,
  xvariable = NULL,
  yvariable = NULL,
  legend_variable = NULL,
  statistics = FALSE,
  xtics_angle = 0,
  legend_variable_order = NULL,
  legend_variable_cut = NULL,
  xvariable_order = NULL,
  xvariable_cut = NULL,
  group_variable_for_line = NULL,
  group_variable_order_for_line = NULL,
  y_add = 0,
  yaxis_scale_mode = NULL,
  notch = FALSE,
  par = NULL,
  outlier = FALSE,
  out_scale = 1.05,
  legend.position = "right",
  manual_color_vector = NULL,
  violin = FALSE,
  violin_nb = FALSE,
  scale_violin = "width",
  ID_var = c(),
  jitter = FALSE,
  jitter_bp = FALSE,
  dotplot = FALSE,
  dotplot_bp = FALSE,
  colormodel = "srgb",
  coordinate_flip = FALSE,
  facet_variable = NULL,
  facet_variable_order = NULL,
  x_label = NULL,
  y_label = NULL,
  title = NULL,
  facet_nrow = NULL,
  facet_ncol = NULL,
  facet_singlecell_style = F,
  facet_scales = "fixed",
  metadata = NULL,
  debug = F,
  filename = NULL,
  extra_ggplot2_cmd = NULL,
  ...
)

Arguments

data

Data file (with header line, the first row is the colname, tab seperated. Multiple formats are allowed and described above)

melted

When TRUE, meaning a long format matrix is supplied to data. function will skip preprocess. Default FALSE.

xvariable

The column represents the x-axis values. For unmelted data, the program will use first column as x-variable. If one want to use first row of unmelted data as x-variable, please specify variable here (which is an inner name). Or if one want to use other columns in metadata.

yvariable

The column represents the digital values. For unmelted data, the program will use value as y-variable (which is an inner name). This parameter can only be set when melted is TRUE.

legend_variable

The column represents the legend information. Default xvariable if not specified.

xtics_angle

Rotation angle for a-axis. Default 0.

legend_variable_order

Levels for legend variable. Default data order, accept a vector like c('TP16','TP22','TP23') for legend_variable column.

legend_variable_cut

Self-define intervals for legend variable when values in legend_variable column is continuous numbers.

xvariable_order

xvariable_order Levels for x-axis variable. Default data order, accept input like c('g','a','j','x','s','c','o','u') for Set column.

xvariable_cut

sxvariable_cut Self-define intervals for x-axis variable.

group_variable_for_line

Specify the group of points to line together (one column name).

group_variable_order_for_line

Levels for group variable for lines.

y_add

A number to add if log scale is used. Default 0 meaning the minimum non-zero value would be used.

yaxis_scale_mode

Give the following scale_y_log10(), coord_trans(y="log10"), or other legal command for ggplot2 or simply log2 to set the scale way.

notch

Using notch (sand clock shape) or not. Default FALSE.

outlier

Exclude outliers. Exclude outliers or not, default 'FALSEā€œ means keeping outliers.

out_scale

The scales for one want to set to exclude outliers. Default 1.05. No recommend to change unless you know what you are doing.

legend.position

Position of legend, accept top, bottom, left, right, none or c(0.8,0.8).

manual_color_vector

Manually set colors for each geom. Default NULL, meaning using ggplot2 default. Colors like c('red', 'blue', '#6181BD') (number of colors not matter) or a RColorBrewer color set like "BrBG" "PiYG" "PRGn" "PuOr" "RdBu" "RdGy" "RdYlBu" "RdYlGn" "Spectral" "Accent" "Dark2" "Paired" "Pastel1" "Pastel2" "Set1" "Set2" "Set3" "Blues" "BuGn" "BuPu" "GnBu" "Greens" "Greys" "Oranges" "OrRd" "PuBu" "PuBuGn" "PuRd" "Purples" "RdPu" "Reds" "YlGn" "YlGnBu" "YlOrBr" "YlOrRd" (check http://www.sthda.com/english/wiki/colors-in-r for more).

violin

Do violin plot plus inner boxplot.

violin_nb

Do violin plot without inner boxplot.

scale_violin

The value given to scale for violin plot. if "area", all violins have the same area (before trimming the tails). If "count", areas are scaled proportionally to the number of observations. If "width", all violins have the same maximum width. 'equal' is also accepted.

ID_var

Other columns one want to treat as ID variable columns except the one given to xvariable.

jitter

Do jitter plot instead of boxplot.

jitter_bp

Do jitter plot overlay with violin plot or boxplot or both.

dotplot

Do dotplot plot instead of boxplot.

dotplot_bp

Do dotplot plot overlay with violin plot or boxplot or both.

coordinate_flip

Rotate the plot from vertical to horizontal. Usefull for plots with many values or very long labels at X-axis

facet_variable

Wrap plots by given column (one of column names should be specified). This is used to put multiple plot in one picture.

facet_variable_order

The levels of wrapping to set the order of each group.

x_label

Xlab label.

y_label

Ylab label.

title

Title of picture.

facet_nrow

The number of rows one want when facet is used. Default NULL.

facet_ncol

The number of columns one want when facet is used. Default NULL.

facet_singlecell_style

Use specified style for showing single cell gene expression profile. Default FALSE.

facet_scales

Paramter for scales for facet. Default fixed meaning each inner graph use same scale (x,y range), free (variable x, y ranges for each sub-plot), free_x (variable x ranges for each sub-plot), free_y (variable y ranges for each sub-plot).

metadata

Giving a metadata file with format specified in example to tell the group information for each sample.

filename

Output picture to given file.

extra_ggplot2_cmd

Extra ggplot2 commands (currently unsupported)

...

Parametes given to sp_ggplot_layout

Value

A ggplot2 object

Examples

1
2
3
4
5
6
7
8
9
box_test_data <- data.frame(ID = letters[1:4],
Gene = letters[c(8,8,9,9,10,10,11,11)], Expr = runif(16))
sp_boxplot(data = box_test_data, xvariable = "ID", value = "Expr", variable ="Gene")

## Not run:
box_data = "box.data"

sp_boxplot(data = box_data, xvariable = "Gene", value = "Expr", variable="Group")
## End(Not run)

Tong-Chen/YSX documentation built on Jan. 25, 2021, 2:49 a.m.