I am plotting time series of several countries with gghighlight_line. I have managed to draw a faceted plot with the trend of each country using the following code:
oecd %>%
  filter(country %in% c("Germany", "France", "United Kingdom", "United States", "Canada", "Japan", "Italy", "Netherlands", "Spain")) %>%
gghighlight_line(., aes(year, pop_65, colour = country, group= country), predicate = max(pop_65) > 0, label_key = " ") +
  scale_x_discrete( breaks = c(2000, 2005, 2010, 2015)) +
   facet_wrap(~ country) +
  theme_minimal()
And producing the following plot:

Now, I am trying to drop the label associated with each line and I wonder whether there is such an option in gghighlight_line. Many thanks in advance
You can add the argument use_direct_label = FALSE to remove labels from the lines.
gghighlight_line(., aes(year, pop_65, colour = country, group= country), predicate = 
                   max(pop_65) > 0, label_key = " ", use_direct_label = FALSE)
Note that this not only removes them from the lines; it also places your labels directly on the plot legend. If for some reason you want to hide them altogether, you can just add at this at the end:
oecd %>%
  filter(country %in% c("Germany", "France", "United Kingdom", "United States", 
"Canada", "Japan", "Italy", "Netherlands", "Spain")) %>%
gghighlight_line(., aes(year, pop_65, colour = country, group= country), predicate = 
max(pop_65) > 0, label_key = " ") +
  scale_x_discrete( breaks = c(2000, 2005, 2010, 2015)) +
   facet_wrap(~ country) +
  theme_minimal() +
  theme(legend.position = "none")  # remove legend
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With