Skip to content

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

@yutannihilation

Description

@yutannihilation

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions