vis_point: Create a scatter plot

Description Usage Arguments Examples

View source: R/low-level-interface-point.R

Description

Functions to create a scatter plot to be sent to the console or written to a file.

Usage

1
2
3
4
5
vis_point(data, aes, names = aes, geom = NULL, ...)

vis_1d_point(data, aes, names = aes, geom = NULL, ...)

vis_2d_point(data, aes, names = aes, geom = NULL, ...)

Arguments

data

A data frame with data to visualize.

aes

A character vector to indicate the columns that should be mapped. Passed to ggplot2::aes_string(). Note that you can also plot aesthetics other than x and y too.

names

The names of the variables to plot. If NULL (the default), the names are inferred form aes.

geom

The bare name of the geom to use. If NULL (the default), it is determined by the class of the data to plot.

...

Passed to the geom. See 'Details'.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# ordinary scatter plots for continuous data
plot <- vis_2d_point(iris,
  c(x = "Sepal.Width", y = "Sepal.Length", size = "Petal.Width")
)
plot %>%
  dplyr::filter(purrr::map_lgl(.data$aes, ~ any(.x %in% "Sepal.Length")))
# jitter plots if both variables are categorical
mtcars %>%
  transform_cols(c("vs", "am"), "as.factor") %>%
  vis_2d_point(c("vs", "am"), width = 0.1, height = 0.1) %>%
  pull_gg()

lorenzwalthert/simplificar documentation built on May 7, 2019, 9:32 a.m.