I have a dataset like these
Region | Greenspace | Bluespace |
---|---|---|
North | 30 | 5 |
South | 50 | 10 |
West | 15 | 2 |
East | 10 | 1 |
data <- data.frame ( stringsAsFactors = FALSE,
Region = c("North", "South", "West", "East"),
Greenspace = c(30,50,15,10),
Bluespace = c(5,10,2,1)
)
I want to create a histogram showing the regions in the x-axis and percentage in the yaxis. I used that code
data %>% pivot_longer(cols = Greenspace:Bluespace) %>% ggplot(aes(x = Region, y = value, fill = name)) + geom_col(position = 'dodge') + ggtitle("Contrast between 4 different region areas for Greenspace and Bluespace") + xlab("Region") + ylab("percentage")+ scale_fill_manual(values=c("blue", "dark green"))
Now the problem is instead of name i want space in the legend. I change fill into name but got error message could not find space.
But the problem is i don't want name, I want space
Has anyone an idea how to fix it. I appreciate every help :)