Skip to content

Latest commit

 

History

History
233 lines (182 loc) · 3.62 KB

hints.md

File metadata and controls

233 lines (182 loc) · 3.62 KB

Hints

Take a peek if you get stuck!

Helpful resources:

Italics

Functions
  • ggplot2
    • ggplot
    • geom_col
    • coord_flip
    • theme
  • ggtext
    • element_markdown

Color axis text

Functions
  • ggplot2
    • ggplot
    • geom_col
    • scale_fill_identity
    • coord_flip
  • ggtext
    • element_markdown

Color & bold axis label

Functions
  • ggplot2
    • ggplot
    • geom_line
    • ylab
    • theme_classic
    • theme
  • ggtext
    • element_markdown

Assign colors manually

Functions
  • RColorBrewer
    • brewer.pal
  • ggplot2
    • ggplot
    • geom_col
    • scale_fill_identity
    • ylab
    • theme_classic

Image on a plot

Functions
  • ggplot2
    • ggplot
    • geom_col
    • ylab
    • theme_classic
  • cowplot
    • ggdraw
    • draw_plot
    • draw_image

Plot on an image

Functions
  • magick
    • image_read
    • image_colorize
  • ggplot2
    • ggplot
    • geom_point
  • cowplot
    • theme_cowplot
    • ggdraw
    • draw_image
    • draw_plot
Theme

All cowplot themes have a transparent background, while ggplot2 themes do not. That's important for layering things behind plots. Order matters!

The Truth

It's awesome that this is possible, but I think this feature's main utility is to create examples of bad plots...

Plots in a grid

Functions
  • ggplot2
    • ggplot
    • geom_boxplot
    • scale_color_discrete
    • facet_wrap
    • ylim
    • labs
    • theme
    • element_blank
  • cowplot
    • theme_cowplot
    • plot_grid

One title for two plots

Functions
  • ggplot2
    • ggplot
    • geom_point
    • theme
    • element_blank
    • margin
  • cowplot
    • theme_half_open
    • background_grid
    • ggdraw
    • draw_label
    • plot_grid

Inset plots

Functions
  • ggplot2
    • ggplot
    • geom_point
    • geom_bar
    • labs
    • scale_y_continuous
  • cowplot
    • theme_minimal_grid
    • theme_minimal_hgrid
    • ggdraw
    • draw_plot
    • draw_plot_label
Theme

All cowplot themes have a transparent background, while ggplot2 themes do not. That's important for layering things behind plots. Order matters!

Overlaying plots

Functions
  • ggplot2
    • ggplot
    • geom_col
    • geom_point
    • scale_y_continuous
    • scale_x_discrete
    • theme
    • element_line
    • element_blank
    • element_text
  • cowplot
    • theme_minimal_hgrid
    • theme_half_open
    • align_plots
    • ggdraw
    • draw_plot
Theme

All cowplot themes have a transparent background, while ggplot2 themes do not. That's important for layering things behind plots. Order matters!

Multi-panel figure

Functions
  • ggplot2
    • ggplot
    • geom_point
    • geom_density
    • stat_smooth
    • scale_y_continuous
    • expand_scale
    • facet_grid
    • theme
  • cowplot
    • background_grid
    • theme_half_open
    • get_legend
    • align_plots
    • plot_grid