sp_barplot | R Documentation |
Generating bar plot
sp_barplot(
data,
metadata = NULL,
color_variable = NULL,
yvariable = NULL,
xvariable = NULL,
melted = TRUE,
title = NULL,
x_label = NULL,
y_label = NULL,
top_n = 1,
statistical_value_type = sum,
keep_filtered_as_others = TRUE,
color_variable_order = NULL,
xvariable_order = NULL,
y_add = 0,
group_variable = NULL,
add_bar_link = FALSE,
add_point = F,
yaxis_scale_mode = NULL,
facet_variable = NULL,
stat = "identity",
bar_mode = "stack",
facet_variable_order = NULL,
facet_nrow = NULL,
facet_ncol = NULL,
error_bar_variable = NULL,
base_font_size = 11,
legend.position = "right",
xtics = TRUE,
xtics_angle = 0,
statistics = FALSE,
ytics = TRUE,
manual_color_vector = "Set2",
facet_scales = "fixed",
extra_ggplot2_cmd = NULL,
coordinate_flip = FALSE,
add_text = FALSE,
font_path = NULL,
debug = FALSE,
filename = NULL,
...
)
data |
Data frame or data file (with header line, the first column will not be treated as row names, tab separated). |
metadata |
Giving a metadata file with format specified in example to tell the group information for each sample. |
color_variable |
Name for specifying bars colors (one of column names, should be specified when inputting long format matrix). |
yvariable |
Name for value column (one of column names, should be specified when inputting long format matrix). |
xvariable |
Name for x-axis variable (one of column names, should be specified when inputting long format matrix). |
melted |
|
title |
Title of picture. |
x_label |
Xlab label. |
y_label |
Ylab label. |
top_n |
An integer larger than 1 will be used to get top x genes (like top 5000). A float number less than 1 will be used to get top x fraction genes (like top 0.7 of all genes). |
statistical_value_type |
Specify the way for statistical computation. Default mad, accept mean, var, sum, median. |
keep_filtered_as_others |
Get sums of all filtered items as an new item - Others. Default FALSE. |
color_variable_order |
Set orders of color variable (this can also used to extract specific rows). |
xvariable_order |
Levels for x-axis variable, suitable when x-axis is not used as a number. |
y_add |
A number to add if log scale is used. Default 0 meaning the minimum non-zero value would be used. |
group_variable |
Specify group info for for computing means and SDs. |
add_point |
Set to TRUE to add each point (specially used when displaying mean values) |
yaxis_scale_mode |
Give the following |
facet_variable |
Wrap plots by given column (one of column names should be specified). This is used to put multiple plot in one picture. |
stat |
The ways to show the height of bars.
The height of bars represent the numerical values in each group by default (normally in |
bar_mode |
The ways to place multiple bars for one group.
Multiple bars in same place will be stacked together by default.
Giving |
facet_variable_order |
The levels of wrapping to set the order of each group. |
facet_nrow |
The number of rows one want when |
facet_ncol |
The number of columns one want when |
error_bar_variable |
Error-bar column (one of column names). Specify the column containing error bars. |
base_font_size |
Font-size. Default 11. |
legend.position |
Position of legend, accept top, bottom, left, right, none or c(0.8,0.8). |
xtics |
Display xtics. Default TRUE. |
xtics_angle |
Rotation angle for a-axis. Default 0. |
ytics |
Display ytics. Default FALSE. |
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). |
facet_scales |
Paramter for scales for facet. Default |
extra_ggplot2_cmd |
Other legal R codes for ggplot2 will be given here. |
coordinate_flip |
Rotate the plot from vertical to horizontal. Usefull for plots with many values or very long labels at X-axis |
add_text |
Add text to bar. Default FALSE. |
font_path |
Specify font type. Give a path for one font type file like '/etc/fonts/Arial.ttf' or 'HeiArial.ttc'(if in current directory), Default system default. |
filename |
Output picture to given file. |
... |
A ggplot2 object
bar_test_data <- data.frame(ID = letters[1:4], Gene = letters[c(8,8,9,9,10,10,11,11)], Expr = runif(16))
sp_barplot(data = bar_test_data, xvariable = "ID", yvariable = "Expr", color_variable = "Gene")
## Not run:
bar_data = "bar.data"
sp_barplot(data = bar_data, xvariable = "ID", yvariable = "Expr", color_variable = "Gene")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.