gghighlight for the win
Posted ongghighlight is a package that is on cran that allows one to highlight
certain features ones finds valuable. Right now I typically do this with
some custom color coding, then pass that into the ggplot2
arguments.
This might serve as a good way to more easily automate this task.
Additionally, this could be super handy during exploratory analysis
where this is much more iterative to find patterns.
Our libraries of course….
This code is copied directly from here.
Build some data which is more some white noise with a random walk.
<- purrr::
d
Definitely some messiness and colour overload!
+
The way I would do it…
<- d %>%
%>%
%>%
+
# draw the original data series with grey
+
# colourise only the filtered data
d_filtered
Now with this handy package we can do the following:
+
+
+
And because it is a ggplot
object we can add things to it.
+
+
+
+
The package author does offer a caveat that the package can run slowly
with lots of data and filtering and to go back to using dplyr
in a
discrete step. I imagine it is because of all the grouped operations?
Dunno, but this is a neat package to use for exploratory work.
Citation
BibTex citation:
@online{dewitt2018
author = {Michael E. DeWitt},
title = {gghighlight for the win},
date = 2018-07-04,
url = {https://michaeldewittjr.com/articles/2018-07-04-gghighlight-for-the-win},
langid = {en}
}
For attribution, please cite this work as:
Michael E. DeWitt. 2018. "gghighlight for the win." July 4, 2018. https://michaeldewittjr.com/articles/2018-07-04-gghighlight-for-the-win