Recently I made a plot using ggplot in R. When I add my code for ggplot_label_repel, suddenly the symbols in the legend change from circles into the letter "a".
Does this have something to do with wingdings font? How do I fix my legend?
I have made some example code with the reproducible error here:
#packages
library(dplyr)
library(ggplot2)
library(ggrepel)
#Creating an example data frame
years <- c(1990:1999)
population <- c(1:10)
df <- tibble(years,population)
#Adding random information to the df so that I can do coloring and labeling on my ggplot
df$group <- "low population"
df[8:10, 3] <- "high population"
df$status <- "highly endangered"
df$status[3:5] <- "endangered"
df$status[5:7] <- "threatened"
df$status[8:10] <- "recovered"
#The ggplot with the legend I want
ggplot(df, aes(years,population, color= group))+
geom_point()
#The ggplot with the labeling I want but the wrong legend
ggplot(df, aes(years,population, color= group))+
geom_point()+
geom_label_repel(data=df %>% filter(group =="high population"),
aes(label= status))
Thank you in advance!
show.legend = FALSE
intogeom_label_repel
;) – Genarogendarme