Kara Woo
February 25, 2021
38

# 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

## Transcript

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

noam ross, julia silge, jacqueline nolis, jarvis miller @accidental__aRt

8. ### data from the palmerpenguins package by allison horst, alison hill,

& kristen gorman
9. ### penguin_plot + geom_text( aes(x = 195, y = 55, label

= "Chinstrap") )
10. ### library("ggrepel") penguin_plot + geom_text_repel( aes(x = 195, y = 55,

label = "Chinstrap") )

13. ### penguin_plot + geom_text( aes(x = 195, y = 55, label

= "Chinstrap") )
14. ### penguin_plot + annotate( geom = "text", x = 195, y

= 55, label = "Chinstrap" )

space

c(200, NA))

c(200, NA))
22. ### 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)) ⚠

28. ### 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

= 1 ) )

31. ### 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), #> … #> }

33. ### penguin_plot + theme( axis.text.y.left = element_text( angle = 90, hjust

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

coord_map()