Learn R Programming

tidyplots (version 0.2.1)

tidyplot: Create a new tidyplot

Description

Create a new tidyplot

Usage

tidyplot(data, ..., width = 50, height = 50, dodge_width = NULL)

Value

A tidyplot object.

Arguments

data

A tidy data.frame to use for plotting.

...

Mappings for the x axis, y axis and color, see examples. Additional argument are passed to ggplot2::aes().

width

Width of the plot area. Defaults to 50.

height

Height of the plot area. Defaults to 50.

dodge_width

For adjusting the distance between grouped objects. Defaults to 0.8 for plots with at least one discrete axis and 0 for plots with two continuous axes.

Examples

Run this code
study %>%
  tidyplot(x = treatment, y = score, color = treatment) %>%
  add_data_points_beeswarm()

study %>%
  tidyplot(x = group, y = score, color = dose) %>%
  add_mean_bar()

# Change plot area size
study %>%
  tidyplot(x = treatment, y = score, color = treatment,
    width = 35, height = 35) %>%
  add_data_points_beeswarm()

# Change dodge_width
study %>%
  tidyplot(x = group, y = score, color = dose, dodge_width = 0.3) %>%
  add_mean_bar()

Run the code above in your browser using DataLab