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

Always look on the bright side of plots

Kara Woo
February 25, 2021

Always look on the bright side of plots

Everyone who creates visualizations in R is bound to make mistakes that prevent their plots from looking as they should. Sometimes, these mistakes create beautiful "accidental aRt", though other times they're just plain frustrating. Either way, however, there's something to be learned. This talk will draw on years of watching both the ggplot2 issue tracker and the @accidental__aRt twitter account to highlight some common plot foibles and explain what they can teach us about how ggplot2 works.

Kara Woo

February 25, 2021
Tweet

More Decks by Kara Woo

Other Decks in Technology

Transcript

  1. (clockwise from top le ft ): miles mcbain, alex hanna,

    noam ross, julia silge, jacqueline nolis, jarvis miller @accidental__aRt
  2. penguin_plot + scale_x_continuous(limits = c(200, NA)) #> Warning: Removed 192

    rows containing non- finite values (stat_smooth). #> Warning: Removed 192 rows containing missing values (geom_point). penguin_plot + coord_cartesian(xlim = c(200, NA)) ⚠
  3. text └── axis.text └── axis.text.x │ └── axis.text.x.bottom │ └──

    axis.text.x.top └── axis.text.y └── axis.text.y.left └── axis.text.y.right
  4. theme_grey #> function (…) #> { #> … #> axis.text.y

    = element_text(margin = margin(r = 0.8 * half_line/2), hjust = 1), #> axis.text.y.right = element_text(margin = margin(l = 0.8 * half_line/2), hjust = 0), #> … #> }
  5. penguin_plot + theme( axis.text.y.left = element_text( angle = 90, hjust

    = 1 ), axis.text.y.right = element_text( angle = 90, hjust = 1 ) )