Golem
Golem

Reputation: 126

How to plot barplots using ggplot in R

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

Upvotes: 0

Views: 38

Answers (1)

Josh White
Josh White

Reputation: 1039

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 = ""
)

Upvotes: 1

Related Questions