I'm trying to use R for plotting a combo chart like the one in the image.
I tried to use the code displayed in the tutorial linked below, which used the line representation for the dot, but it gives me the errorr "geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?
(https://www.geeksforgeeks.org/combine-bar-and-line-chart-in-ggplot2-in-r/).
Do you have any suggestion on how to do it?
I tried to use the code below, I don't know if the variable in the first column of the csv file is accepted for the x axis as it's composed by country names.
library(readr)
ComboR <- read_csv("C:/Users/Giulio/Downloads/ComboR.csv")
View(ComboR)
library(ggplot2)
dataco <- data.frame(ComboR$...1, ComboR$B2014, ComboR$`BAU 2050`)
ggp <- ggplot(dataco) +
geom_bar(aes(x=ComboR$...1, y=ComboR$B2014),stat="identity", fill="cyan",colour="#006000")+
geom_line(aes(x=ComboR$...1, y=ComboR$`BAU 2050`),stat="identity",color="red",size=2)+
labs(title= "try",
x="commodities",y="%import")
ggp