Description Usage Arguments Value Examples
Generating bar plot
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 | sp_barplot(
data,
color_variable = NULL,
yvariable = NULL,
xvariable = NULL,
melted = TRUE,
title = NULL,
x_label = NULL,
y_label = NULL,
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). |
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. |
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 |
Flip cartesian coordinates so that horizontal becomes vertical, and vertical, horizontal. This is primarily useful for converting geoms and statistics which display y conditional on x, to x conditional on y. |
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
1 2 3 4 5 6 7 8 | 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.