Skip to content

Instantly share code, notes, and snippets.

@kcui23
Created September 17, 2023 17:52
Show Gist options
  • Save kcui23/1f5bfa82841aa05c7fdb0b9a830ef410 to your computer and use it in GitHub Desktop.
Save kcui23/1f5bfa82841aa05c7fdb0b9a830ef410 to your computer and use it in GitHub Desktop.
STAT679 readings

Small Multiples and Faceting

Motivation:

  • want to show more variables or dimensions at the same time

Technical Details

  • we can use facet_grid or facet_wrap to do that
  • you can use different types of figure like scatterplot, line, barplot
  • you can use scale = “free_y” in facet function to allow different scales in different raws
  • you can always use reorder() to change the order of variables
  • facet_grid
    • Let the data expand according to a certain row/column in the figure
    • you can facet by two variables and specify which variable goes in rows and which goes in columns
  • facet_wrap
    • jsut to display some groups and don’t need them to appear in the same row or column
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment