Home > OS >  How to plot barplots using ggplot in R
How to plot barplots using ggplot in R

Time:11-18

I was trying to create a barplot using ggplot but couldn't get the right result. This is my data set:

enter image description here

I'm trying to create a barplot like this: enter image description here

CodePudding user response:

You would do (assuming your dataframe is called d):

library(tidyverse)
d %>%
  ggplot(aes(x = continent, y = continental_sum))  
  geom_bar(stat = "identity", fill = "blue")  
  labs(
   title = "Total Death Per Continent",
   y = "Total Death Count",
   x = ""
)

  • Related