yutannihilation / gghighlight

Highlight points and lines in ggplot2

Home Page:https://yutannihilation.github.io/gghighlight/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gghighlight fails to label points with lines when there are no group

yutannihilation opened this issue · comments

Originally reported at: https://community.rstudio.com/t/gghighlight-label-key-producing-error/56052

library(tidyverse)
library(gghighlight)

set.seed(47)
df <- tibble::tibble(
  a = seq(0, 100, by = 5),
  b = runif(21)
)

library(tidyverse)
library(gghighlight)

set.seed(47)
df <- tibble::tibble(
  a = seq(0, 100, by = 5),
  b = runif(21)
)

ggplot(df) +
  aes(x = a, y = b) + 
  geom_line() +
  geom_point() +
  gghighlight(b == max(b), label_key = a) +
  theme_minimal()
#> Error: `vars` must be a character vector

ggplot(df) +
  aes(x = a, y = b) + 
  geom_line() +
  geom_point() +
  gghighlight(b == max(b), label_key = a, n = 1) +
  theme_minimal()

Created on 2020-03-11 by the reprex package (v0.3.0)