Highlight Lines and Points in 'ggplot2'

Make it easier to explore data with highlights.

Highlight geoms in ggplot2.


# install.packages("devtools")


Suppose we have a data that has so many series that it is hard to identify them by their colours as the differences are so subtle.

ggplot(d) +
  geom_line(aes(idx, value, colour = type))

With gghighlight(), we can highlight the lines whose max values are larger than 20:

p <- ggplot(d) +
  geom_line(aes(idx, value, colour = type)) +
  gghighlight(max(value) > 19)
#> label_key: type

The result is an usual ggplot object, so it is fully customizable. For example, it can be used with custom themes and facets.

p + theme_minimal()

p + theme_minimal() + facet_wrap(~ type)

gghighlight() can highlight almost any geoms. For more details, please read Introduction to gghighlight.


gghighlight 0.1.0

  • Add gghighlight(), which replaces the current gghighlight_line() and gghighlight_point(); these functions are now deprecated.
  • Add a introductory vignette.

gghighlight 0.0.1

  • First release

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.3.2 by Hiroaki Yutani, 8 months ago


Report a bug at https://github.com/yutannihilation/gghighlight/issues

Browse source code at https://github.com/cran/gghighlight

Authors: Hiroaki Yutani [aut, cre]

Documentation:   PDF Manual  

MIT + file LICENSE license

Imports dplyr, ggrepel, lifecycle, purrr, rlang, tibble

Depends on ggplot2

Suggests knitr, rmarkdown, sf, testthat, vdiffr

Suggested by brolgar.

See at CRAN