Hello,
I'm plotting 2 series of data using geom_line but I have a minor error.
If you run the code, You can see that the legend shows some "a" for each line plotted.
I don't know where that text comes from.
It appears only when I add the geom_text.
Is there any way to show the legend without that annoying letter "a"?
I asked geminis.google.com but It failed to solve this issue.
Thanks for your time and interest.
Have a nice weekend.
library(tidyverse)
library(scales)
world_bank_pop %>%
pivot_longer(cols = `2000`:`2017`,
names_to = "year",
values_to = "value") %>%
filter(country %in% c("CHL", "ECU"), indicator == "SP.POP.TOTL") %>%
mutate(year = as.numeric(year)) %>%
ggplot(aes(x = year, y = value, color = country)) +
geom_line() +
geom_point(shape=23, color="black", fill="white", alpha=0.5)+
scale_y_continuous(
labels = label_number(decimal.mark = ",",big.mark = "."),
breaks = seq(13e6,19e6,0.5e6),
name="Población"
)+
geom_text(aes(label = format(round(value/1e3, 0), big.mark = ".", scientific = FALSE)),
vjust = -0.5, nudge_y = +1,family = "Gentium" )+
scale_x_continuous(
breaks = 2000:2017,
name="Años"
) +
scale_color_manual(values = c("CHL" = "blue", "ECU" = "red"),
labels = c("CHL" = "Chile", "ECU" = "Ecuador"))