I have data that looks like this:
I want to run a linear regression model on it and instead of the usual dots use country flags using ggflas
(https://github.com/jimjam-slam/ggflags):
Data <- read.xlsx(
paste0(mainDirectory, "Data.xlsx"),
"Data")
ggplot(Data, aes(x = x, y = y, country=country, size = 11)) +
geom_flag() +
scale_country() +
scale_size(range = c(10, 10)) +
geom_smooth(method = "lm", se = FALSE)
This works fine, except for me not getting the regression line to show up:
Do you have any idea why and how I could get both the flags and the regression line in the same plot?