plot_bar | R Documentation |
this function displays a bar graph from a data frame containing x-axis categories using ggplot2.
plot_bar(data, label_x = "", label_y = "", colors = NULL, alpha = 1)
data |
data.frame contain x, value, and variable |
label_x |
x-axis label |
label_y |
y-axis label |
colors |
color vector |
alpha |
level of transparency |
returns a ggplot graphic
#summarizing iris dataset
data <- iris |> dplyr::group_by(Species) |>
dplyr::summarize(Sepal.Length=mean(Sepal.Length))
head(data)
#ploting data
grf <- plot_bar(data, colors="blue")
plot(grf)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.