tealviz is a collection of data visualization tools for Teal
Emery + Teal
Insights.
The package is publicly available on GitHub with a permissive (MIT)
license to facilitate the reproducibility of Teal Emery + Teal Insights
analysis. I kindly ask that you don’t use it for your own work, however
you are welcome to use the code as a building block to create your own
data viz package.
This package builds upon a package that Cara Thompson helped me build. I’m a researcher, not an artist, so having such a skilled designer help me build this package was a huge help. I highly recommend her work. The inspired coding & visual design work are hers. The mistakes are mine.
To install on Ubuntu, you may first need to install libmagick++-dev on
your system by running the following commands in your terminal:
sudo apt-get update
sudo apt-get install libmagick++-devYou can install the development version of tealviz from GitHub with:
devtools::install_github("t-emery/tealviz")tealviz assumes that the user has fonts installed on their computer.
The package will attempt to install fonts for you, but may not succeed
depending on your operating system and permissions. If you do not have
the fonts installed, the package will not work. The fonts used in this
package are: Roboto, Roboto Condensed, Lora, and Lora Bold. You
can install them manually from Google
Fonts. They are also available as assets in
the tealviz package. You can find them in the
inst/assets/fonts
folder of the GitHub repo. You can install them with the extrafont
package.
Fonts are tricky in R. If you’re having trouble, read this excellent explainer by June Choe.
The core of the tealviz package is a series of ggplot2 custom
themes, and custom colors/palettes.
library(tealviz)
# On loading the package, the `font_hoist()` function automatically makes sure the fonts are available for use. You will see messages in the console to inform you whether the fonts loaded correctly or not.
library(ggplot2)
palmerpenguins::penguins |>
dplyr::filter(!is.na(bill_length_mm),
!is.na(flipper_length_mm),
!is.na(body_mass_g)) |>
ggplot() +
geom_point(aes(x = bill_length_mm,
y = flipper_length_mm,
size = body_mass_g,
fill = body_mass_g),
shape = 21,
color = ti_colors$background) +
labs(title = "Perfectly proportional penguins",
subtitle = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
x = "Bill length (mm)",
y = "Flipper length (mm)",
fill = "Body mass (g)",
caption = "Demo plot, built with {palmerpenguins}") +
guides(size = "none") +
scale_fill_ti(continuous = TRUE) +
theme_ti()The Title and Subtitle use
ggtext under
the hood. This adds powerful functionality, to be explored in its own
vignette. For now, know that it will auto-wrap the subtitle so you can
provide commentary about the visualizations key takeaways without
worrying about line breaks.

