The Anatomy of a Plot

Daniel Marcelino <dmarcelino@live.com>

August 04, 2016

1 Overview

This document presents several wrapper functions to make plotting with ggplot2 a lot easier.

2 Preview ggplot2 themes

Previewplot() can be used to preview ggplot2 themes and features.

library("SciencesPo", quietly = TRUE)
Previewplot()

3 Themes

Previewplot() + theme_pub()

Previewplot() + theme_darkside()

4 Title

4.1 Align title right

Align ggplot2 title to the right.

gg + align_title_right()

4.2 Align title left

Align ggplot2 title to the left.

gg + align_title_left()

4.3 Remove ggplot2 title

Do not show plot title.

gg + no_title()

5 Plot Axes

5.1 Remove ggplot2 x-axis

Remove the x axis from a ggplot2 including the axis lines, titles, labels and ticks.

gg + no_x_axis()

5.2 Remove ggplot2 y-axis

Remove the y axis from a ggplot2 including the axis lines, titles, labels and ticks.

gg + no_y_axis()

5.3 Remove ggplot2 Axes

Remove both axes from a ggplot2 including the axes lines, titles, labels and ticks.

gg + no_axes()

5.4 Remove ggplot2 x-axis line

Do not show x-axis line.

gg + no_x_line()

5.5 Remove ggplot2 y-axis line

Do not show y-axis line.

gg + no_x_line()

5.6 Remove ggplot2 x-axis text/labels

Do not show x-axis text/labels

gg + no_x_text()

5.7 Remove ggplot2 y-axis text/labels

Do not show y-axis text/labels.

gg + no_y_text()

5.8 Remove ggplot2 x-axis tick marks

Do not show tick marks for x-axis.

gg + no_x_ticks()

5.9 Remove ggplot2 y-axis tick marks

Do not show tick marks for y-axis.

gg + no_y_ticks()