sp_lines | R Documentation |
Generating lines plot
sp_lines(
data,
melted = FALSE,
xvariable = NULL,
xvariable_order = NULL,
y_add = 0,
yvariable = NULL,
yaxis_scale_mode = "",
legend_variable = NULL,
legend_variable_order = NULL,
color_variable = NULL,
color_variable_order = NULL,
error_bar_variable = NULL,
x_label = NULL,
y_label = NULL,
y_start_from_zero = T,
title = "",
smooth_method = "no smooth",
line_size = NULL,
alpha = 0.6,
manual_color_vector = NULL,
xtics = TRUE,
xtics_angle = 0,
ytics = TRUE,
legend.position = "right",
manual_xtics_pos = NULL,
manual_xtics_value = NULL,
width = 10,
height = 10,
custom_vline_x_position = NULL,
custom_vline_anno = NULL,
custom_hline_y_position = NULL,
custom_hline_anno = NULL,
facet_wrap_formula = NULL,
facet_wrap_nrow = NULL,
facet_wrap_ncol = NULL,
filename = NULL,
coordinate_flip = FALSE,
debug = FALSE,
...
)
data |
Data frame or data file (with header line, the first column will not be treated as the rowname, tab seperated) |
melted |
When true, it will skip melt preprocesses and each column wolud be treated as separate attributes. Default FALSE, accept TRUE. |
xvariable |
Name for x-axis variable. For normal matrix, default the first column will be used, The program will assign an value 'xvariable' to represent it. |
xvariable_order |
Set orders of x-variable. For normal matrix, |
y_add |
A number to add if scale is used. Default 0 meaning the minimum non-zero value wolud be used. |
yvariable |
Name for y-axis variable. For normal matrix, all numbers except the first row and first column would be used. The program will assign an value 'value' to represent it. Default value. |
yaxis_scale_mode |
Give the following |
legend_variable |
Name for legend variable. Default variable for normal matrix (un-melted),
When |
legend_variable_order |
Set orders of legend variable. Default column order for normal matrix, accept a vector like c('CTCF','H3K27ac','Enhancer') to set your own order. |
color_variable |
Name for color variable. Normally used when wanting to color lines by groups.
Default same as |
color_variable_order |
Set orders of color variable.
Only used when |
error_bar_variable |
Error-bar column (one of column names). Specify the column containing error bars. |
x_label |
Xlab label. Default empty. |
y_label |
Ylab label. Default empty. |
y_start_from_zero |
Set Y-axis ranges from zero. Default TRUE. |
title |
Title of picture. |
smooth_method |
The smooth method one wants to use, eg. auto, lm, glm, gam, loess, rlm. For observations < 1000 default is 'loess', observations >= 1000 defaults to 'gam'. Default 'no smooth' meaning show the real lines and do not smooth lines. Accept auto, lm, glm, gam, loess, rlm. |
line_size |
line size. Default NULL. Accept a number. |
alpha |
Color transparency value. Default 0.6. Accept a number between 0-1. |
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). |
xtics |
Default TRUE to display xtics. Accept FALSE to turn off xtics. |
xtics_angle |
Rotation angle for x-tics (anti clockwise), Default 0. |
ytics |
Default TRUE to display ytics. Accept FALSE to turn off ytics. |
legend.position |
Position of legend, accept top, bottom, left, right, none or c(0.8,0.8). |
manual_xtics_pos |
Manually set the positions of xtics. Default FALSE, accept a vector of numbers in following format "c(1,2,3,4,5)" or other R code that can generate a vector to set the position of xtics. |
manual_xtics_value |
Manually set the values of xtics when |
width |
Picture width (units: cm) |
height |
Picture height (units: cm) |
custom_vline_x_position |
A vector of coordinates for vertical lines. |
custom_vline_anno |
Annotation text for each vertical line. |
custom_hline_y_position |
A vector of coordinates for horizontal lines. |
custom_hline_anno |
Annotation text for each horizontal line. |
facet_wrap_formula |
The formula for |
facet_wrap_nrow |
Number of facet rows. Default NULL meaning no facets. Currently unused. |
facet_wrap_ncol |
Number of facet columns. Default NULL meaning no facets. Currently unused. |
filename |
Output name of pictures. |
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. |
... |
Parametres given to |
x_level |
Levels for x-axis variable, suitable when x-axis is not treated as numerical. Default the order of first column for normal matrix. |
A ggplot2 object
res_output <- data.frame(Pos=1:10,value =runif(20))
value=0.5
res_output$Variable <- ifelse(res_output$value<=value,"groupA", "groupB")
sp_lines(data=res_output, color_variable = "Variable", variable="Variable")
## Not run:
lines_data = "lines.data"
sp_lines(data=lines_data, xvariable = "Pos", yvariable = "value", color_variable = "Variable", variable="Variable")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.