enter image description hereI am having a problem with my ggplot that i cannot insert a legend. I just want to show the total number of facilities per region (manually).
Here is my code: Note: my csv file has 17,333 IDs, I was thinking maybe that is why but I'm not really sure so.
library(ggplot2)
library(dplyr)
library(ggthemes)
library(tidyverse)
doh = read.csv("doh.csv")
doh %>%
  ggplot(aes( y = region, color = region)) +
  geom_bar(position = "identity", size = 0.7, alpha = 0.8, fill = "#28d1eb", colour="black") +
  
  labs(title = "Total Number of COVID-19 Facilities per Region",
       x = "Count",
       y = "Region") +
  theme_minimal() +
  
  theme(plot.title = element_text(lineheight=6, face="bold", color="black",size=15)) 
I have tried inserting a legend in my code but it isn't working and I'm not sure where I went wrong.
code:
library(ggplot2)
library(dplyr)
library(ggthemes)
library(tidyverse)
doh = read.csv("doh.csv")
doh %>%
  ggplot(aes( y = region, fill = region, color = region)) +
  geom_bar(position = "identity", size = 1.0, alpha = 0.8, fill = "#28d1eb", colour="black") +
  
  labs(title = "Total Number of COVID-19 Facilities per Region") +
  theme_minimal() +
  
  theme(plot.title = element_text(lineheight=6, face="bold", color="black",size=15)) +
  barplot(data, 
          col = c("#f2b50c", "#d96fe3")) +
  legend("topright",
         legend = c("REGION XIII (CARAGA)"))
PS: I only included the "REGION XIII (CARAGA)" because I just want to see if its working but its not.
Thanks in adv!
 
    
