I would like to change the dots in the next plot to the flag for the respective country. For this I know that geom_flag() could works, but... not for me but I got stuck with this error message:
Error in grobify(picture, x = x, y = y, width = width, height = height, :
object '.flaglist' not found
This is my code:
ggplot(df, aes(lenght, Ponto.Caspian)) +
geom_point()+ ggflags::geom_flag(aes(x = longitude, y = latitude+0.5, country = country))
maybe also geom_image() could work but I don't know how to link the flag with the country column...or How to use an image as a point in ggplot?, but I don't understand the process
This my desire plot, but changing dots to flags:
ggplot(df, aes(lenght, Ponto.Caspian)) +
geom_point(aes(colour = factor(country)))+
scale_fill_brewer(palette = "Set3")+ scale_x_continuous(breaks = seq(10, 40, by = 5))+
scale_y_continuous(breaks = seq(0, 16, by = 1))+
theme_classic2() + theme_cleveland()+ geom_smooth(method = "lm", alpha=0.2)+
stat_cor(label.x = 2, label.y = 1)
This is my data: https://drive.google.com/drive/folders/1qR2mUdrpStOYBmxajc_F4nxS_qf-4bzf?usp=sharing
thanks in advance