You can use either barplot or ggplot2 and have a graph of the following
quantity <- c(3, 5, 2) names(quantity) <- c("apples", "banans", "pears") barplot(quantity, main="Fruit Names vs. Quantity", xlab = "Names", ylab="Quantity", col=c("blue", "red", "yellow")) legend("topright", legend=c("apples", "banas", "pears"), fill=c("blue", "red", "yellow"))

source share