Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Adding a Touch of glitr

Aaron
September 19, 2023

Adding a Touch of glitr

Adding a Touch of glitr: Developing a Package of Themes on Top of ggplot
Aaron Chafetz & Karishma Srikanth
Posit Conf 2023 | Chicago

How do you create brand cohesion across your large team when it comes to data viz? My colleague and I, inspired by the BBC's bbplot, developed a package on top of ggplot2 to create a common look and feel for our team's products. This effort improved not just the cohesiveness of our work, but also trustworthiness. By creating this package, we reduced the reliance on using defaults and the time spent on each project customizing numerous graphic elements. More importantly, this package provided an easier on-ramp for new teammates to adopt R. We would like to share our journey within a federal agency developing a style guide, to guide and inspire other organizations who could benefit from developing their own branding package and guidance.

Links
glitr R package - https://github.com/USAID-OHA-SI/glitr
OHA Data Visualization Style Guide - https://issuu.com/achafetz/docs/oha_styleguide

Aaron

September 19, 2023
Tweet

More Decks by Aaron

Other Decks in Design

Transcript

  1. View Slide

  2. 2
    This presentation was made possible by the support of the American people
    through the United States Agency for International Development (USAID) under
    the U.S. President's Emergency Plan for AIDS Relief (PEPFAR). The contents in
    this presentation are the sole responsibility of the authors, and do not
    necessarily reflect the views of USAID, PEPFAR or the United States Government.

    View Slide

  3. View Slide

  4. View Slide

  5. View Slide

  6. Office of HIV/AIDS

    View Slide

  7. Taking a stroll down memory lane

    View Slide

  8. +100 colors
    used in a single
    presentation

    View Slide

  9. How do we create coherence and
    efficiency across all our work?

    View Slide

  10. View Slide

  11. 55 countries
    USAID/PEPFAR is
    actively working in

    View Slide

  12. Karishma
    Aaron

    View Slide

  13. Karishma
    Aaron

    View Slide

  14. View Slide

  15. Explore existing products universe
    Refinements to ggplot
    Packaging with a style guide

    View Slide

  16. View Slide

  17. Understand
    existing
    workflows

    View Slide

  18. Codify what exists from
    existing element

    View Slide

  19. View Slide

  20. Repeating the same ggplot theme
    elements across the same file (and others)
    Repeating hex colors throughout that are
    not standard across files
    Repeating standard exports size and dpi for
    presentation usage

    View Slide

  21. View Slide

  22. View Slide

  23. Explore existing products universe
    Refinements to ggplot
    Packaging with a style guide

    View Slide

  24. Plot
    Elements
    Typeface Color

    View Slide

  25. Declutter
    +
    Show the
    data

    View Slide

  26. ggplot2::theme_minimal()

    View Slide

  27. ggplot2::theme_minimal() %+replace%
    ggplot2::theme(
    plot.title = ggplot2::element_text(
    family = font_title,
    size = 14 * text_scale,
    face = "bold",
    color = color_title,
    margin = ggplot2::margin(b = half
    hjust = 0),
    plot.subtitle = ggplot2::element_te
    family = font_subtitle,
    ggplot2::theme_minimal()

    View Slide

  28. Plot
    Elements
    Color
    Typeface

    View Slide

  29. View Slide

  30. grDevices::windowsFonts(
    glitr_font_default =
    grDevices::windowsFont(
    "Source Sans Pro"))
    extrafont grDevices

    View Slide

  31. p +
    si_style()
    Aa

    View Slide

  32. Typeface
    Plot
    Elements
    Color

    View Slide

  33. View Slide

  34. View Slide

  35. MEDIUM BLUE USAID RED
    USAID

    View Slide

  36. Adobe Color Palettable Viz Palette
    MEDIUM BLUE USAID RED
    USAID

    View Slide

  37. Adobe Color Palettable Viz Palette
    MEDIUM BLUE USAID RED
    USAID
    DENIM OLD ROSE
    OHA

    View Slide

  38. View Slide

  39. Lisa Charlotte Muth
    blog.datawrapper.de/category/color-in-data-vis/

    View Slide

  40. View Slide

  41. usaid-oha-si.github.io/glitr/

    View Slide

  42. si_palettes
    si_rampr()
    si_style()
    scale_fill/color_si()
    si_preview()
    si_save()

    View Slide

  43. si_palettes
    si_rampr()
    si_style()
    scale_fill/color_si()
    si_preview()
    si_save()

    View Slide

  44. p +
    labs(subtitle = "default")
    BASE GGPLOT

    View Slide

  45. p +
    labs(subtitle = "default")
    p +
    labs(subtitle = "glitr") +
    scale_fill_si() +
    si_style_ygrid()
    BASE GGPLOT GGPLOT + GLITR

    View Slide

  46. “It just works”

    View Slide

  47. Explore existing products universe
    Refinements to ggplot
    Packaging with a style guide

    View Slide

  48. How to apply
    and socialize
    these elements?

    View Slide

  49. 49
    “PEPFAR has prioritized, and made significant progress
    toward, transitioning a substantial majority of our funding
    by agency to local partners”

    View Slide

  50. 50
    “PEPFAR has prioritized, and made significant progress
    toward, transitioning a substantial majority of our funding
    by agency to local partners”

    View Slide

  51. 51
    Sorted
    Colors
    Clutter
    Title
    Labels
    Axes
    Four operating units
    achieved USAIDʼs
    70% goal
    Local partner share of budget
    70% goal
    All of these operating
    units fell short of the
    70% of goal.
    “PEPFAR has prioritized, and made significant progress
    toward, transitioning a substantial majority of our funding
    by agency to local partners”

    View Slide

  52. View Slide

  53. 53
    tinyurl.com/ohastyleguide

    View Slide

  54. So what?

    View Slide

  55. Before glitr and
    our Style Guide
    After glitr and
    our Style Guide

    View Slide

  56. View Slide

  57. INVENTORY
    OF UNIVERSE
    REFINEMENTS
    IN GGPLOT
    PACKAGE AND
    SOCIALIZE

    View Slide

  58. View Slide

  59. View Slide

  60. View Slide

  61. Links to Resources
    ● Git/Github
    ○ Happy with Git and GitHub for the useR (Bryan)
    ○ USAID-OHA-SI Organizational GitHub
    ● Plot Elements
    ○ ggplot2 GitHub (Posit)
    ○ glitr GitHub (Essam et al, USAID)
    ● Color
    ○ Adobe Color
    ○ Viz Palette (Meeks and Lu)
    ○ Color in Data Viz (Muth, Data Wrapper)
    ● Package
    ○ R Packages (Wickham and Bryan)
    ○ Writing an R package from scratch (Westlake)
    ○ Getting down with pkgdown (Richardson)
    ○ Your first R package in 1 hour (Pileggi)
    ● Style Guide
    ○ OHA Data Visualization Style Guide (Chafetz and Essam)
    ○ City Intelligence Data Design (Brondbjerg)
    ○ Urban Institute Data Visualization Style Guide (Chartoff and Schwabish)
    ○ Style Guide collection

    View Slide

  62. Notes and Attribution
    ● Prepared for Posit Conf 2023 in Chicago [September 19, 2023]
    ○ Aaron Chafetz, Senior Economist, USAID/Office of HIV/AIDS
    ○ Karishma Srikanth, Data Analyst, USAID/Office of HIV/AIDS
    ○ Support and feedback from: Josh Davis, Tim Essam, Jessica Hoehner, Baboyma Kagniniwa, and Amanda Makulec
    ● USAID Graphics Standards Manual and Partner Co-Branding (2020)
    ● Lisa Charlotte Muth Datawrapper Blog
    ● PEPFAR Annual Report to Congress (2022)
    ● Aaron Chafetz and Tim Essam “Data Visualization Style Guide” Office of HIV/AIDS (2020)
    ● Aaron Chafetz and Tim Essam “Visualizing Data: Using Data to Tell a Story” (2023)
    ● Image sources
    ○ “A man hand pointing or touching screen” indysystem [Adobe Stock]
    ○ “Paint brushes nex to drawing book and water color palette” Tim Arerbury [Unsplash]
    ○ “Person looking at painting” Antenna [Unsplash]
    ○ Nike Logo [Wikipedia]
    ○ “Person standing in front of trees” Andrew Neel [Unsplash]
    ○ “White paint palette with paint brush” Glen Carrie [Unsplash]
    ○ “A large grid of pins connected with string” ink drop [Adobe Stock]
    ○ “person holding white dandelion flower” Ivan Dostal [Unsplash]
    ○ “Painting by numbers with acrylics on cotton canvas is a hobby for practicing at home” Anna Huchak [Adobe Stock]
    ○ “Echo” wandering echos [Unsplash]
    ● Icon sourced from the Noun Project - Stairs by Setyo Ari Wibowo, hourglass by Mello, Laptop by Emmanuel Garcia Frias, Book by Abner
    Ignatius, Glasses by Nico Ilk

    View Slide