Description Usage Arguments Value Examples
Generating histogram 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 40 41 42 43 44 | sp_histogram(
data,
melted = FALSE,
xvariable = NULL,
color_variable = NULL,
color_variable_order = NULL,
group_variable = NULL,
group_variable_order = NULL,
value_scale = 1,
facet_variable = NULL,
facet_variable_order = NULL,
maximum_allowed = Inf,
yaxis_statistics = "count/sum(count)",
plot_type = "line",
binwidth = NULL,
hist_bar_position = "identity",
alpha = 0.4,
yaxis_scale_mode = NULL,
y_add = 0,
fill_area = FALSE,
line_size = 1,
add_mean_value_vline = FALSE,
manual_color_vector = "Accent",
facet_scales = "fixed",
facet_ncol = NULL,
facet_nrow = NULL,
xtics = TRUE,
ytics = TRUE,
legend.position = "right",
xtics_angle = 0,
manual_xtics_value = NULL,
manual_xtics_pos = NULL,
custom_vline_x_position = NULL,
custom_vline_anno = NULL,
x_label = NULL,
y_label = NULL,
title = "",
font_path = NULL,
debug = F,
extra_ggplot2_cmd = NULL,
filename = NULL,
base_font_size = 11,
...
)
|
data |
Data frame or data file (with header line, the first column will not be treated as the row-names, tab separated) |
melted |
|
xvariable |
Specify the column name used as Y-axis value (one of column names, should be specified when inputting long format matrix). |
color_variable |
Specify the column name used as color variable. |
color_variable_order |
Levels for color variable to set their appearing order.
Accept a vector like |
group_variable |
Specify the column name used as group variable. |
group_variable_order |
Levels for color variable to set their appearing order.
Accept a vector like |
value_scale |
Scale value. All values will be divided by supplied one. Default 1. |
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 |
Order of facets (to set the appearance order of each subplot).
Accept a vector like |
maximum_allowed |
The largest value allowed. Values other than this will be set as this value. Default Inf. |
yaxis_statistics |
Plot with density or count or frequency in y-axis.
Default |
plot_type |
Plot frequency or density or hist or both frequency and histogram.
Default line means frequency accept |
binwidth |
The value for |
hist_bar_position |
Position parameter for hist bars. Default |
yaxis_scale_mode |
Give the following |
y_add |
A number to add if log scale is used. Default 0 meaning the minimum non-zero value would be used. |
fill_area |
Fill the area if TRUE. Default FALSE. |
line_size |
line size. Default 1. Accept a number. |
add_mean_value_vline |
Add mean value as vline. Default FALSE, accept TRUE. |
facet_scales |
Paramter for scales for facet. Default |
facet_ncol |
The number of columns one want when |
facet_nrow |
The number of rows one want when |
xtics |
Show the X axis. |
ytics |
Show the Y axis. |
legend.position |
Position of legend, accept top, bottom, left, right, none or c(0.8,0.8). |
xtics_angle |
Rotation angle for a-axis. Default 0. |
manual_xtics_value |
Manually set the values of xtics when |
manual_xtics_pos |
Manually set the positions of xtics. Default FALSE, accept a series 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 manual xtics. |
custom_vline_x_position |
A vector of coordinates for vertical lines. |
custom_vline_anno |
Annotation text for each vertical line. |
x_label |
Xlab label. |
y_label |
Ylab label. |
title |
Title of picture. |
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. |
extra_ggplot2_cmd |
Extra ggplot2 commands (currently unsupported) |
filename |
Output picture to given file. |
... |
Other parameters given to sp_ggplot_layout |
A ggplot2 object
1 2 3 4 5 6 7 8 9 | histogram_test_data <- data.frame(Type = letters[1:2], Value = runif(80))
sp_histogram(data = histogram_test_data, xvariable = "Value", color_variable = "Type",
plot_type = "both", yaxis_statistics = "count/sum(count)")
## Not run:
input <- "histogram.data"
sp_histogram(data=input, xvariable = "Value", color_variable = "Type",
plot_type = "both", yaxis_statistics = "count/sum(count)")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.