main.r239 chars10 lines
This code will create a barchart using ggplot2 in R. The data
object is a simple data frame with the category labels in the category
column and the corresponding counts in the count
column.
The ggplot()
function initializes the plot and defines the data
object and the aes()
(aesthetics) of the plot, mapping the category
to the x-axis and count
to the y-axis.
The geom_bar()
function creates the bars of the barchart with stat = "identity"
which means the heights of the bars will correspond to the count
values in the data frame.
gistlibby LogSnag