Description Usage Arguments Value Examples
Do a simple barplot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
df |
Data frame |
x |
Character - Which column use for x axis (quoted variable), should correspond to a character column |
y |
Character - Which column use for y axis (quoted variable), should correspond to a numeric column |
fill |
Character - Which column use for the slices of the bar plot (quoted variable), should correspond to a character column |
bar_labels |
TRUE or FALSE - to add the label inside the graph itself to the bar |
flip |
TRUE or FALSE - to flip to horizontal mode |
legend |
TRUE or FALSE - if TRUE the two following items must be passed to the function, if FALSE then automatic legends |
legend_colors |
List - Correspondance between fill categories and colors |
legend_label |
Character - Title of the legend |
A ggplot2 object
1 2 3 4 5 6 7 | p <- dv_bar_discrete (cultures_division,x="division", y="n_strains", fill="domain",
ymin=0, ymax=400, xlab="Division", ylab="Number of strains",
bar_labels=TRUE, flip=TRUE,
legend=TRUE,
legend_colors = c("deposit" = "yellow", "collaborator" = "blue",
"public" = "red", "education" = "green", "private"="black"),
legend_label = "order type")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.