Introduction to gghighlight
DRANK

MotivationSuppose 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.set.seed(2) d <- purrr::map_dfr( letters, ~ data.frame( idx = 1:400, value = cumsum(runif(400, -1, 1)), type = ., flag = sample(c(TRUE, FALSE), size = 400, replace = TRUE), stringsAsFactors = FALSE ) )To filter the data to the reasonable number of lines, we can use dplyr’s filter() here.But, it seems not so handy. For example, what if we want to change the threshold in predicate (max(value) > 20) and highlight other series as well? It’s a bit tiresome to type all the code above again every time we replace 20 with some other value.Besides, considering one of the main purposes of visualization is to get the overview of a data, it may not be good to simply filter out the unmatched data because the plot loose its context then.Here comes gghighlight package, dplyr::filter() equivalent for ggplot2.(If you are inte…

yutannihilation.github.io
Related Topics: