powered by
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)
returns a ggplot graphic
data.frame contain x, value, and variable
x-axis label
y-axis label
color vector
level of transparency
#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)
Run the code above in your browser using DataLab