Learn R Programming

DataExplorer (version 0.6.0)

plot_scatterplot: Create scatterplot for all features

Description

This function creates scatterplot for all features fixing on a selected feature.

Usage

plot_scatterplot(data, by, title = NULL, ggtheme = theme_gray(),
  theme_config = list(axis.text.x = element_text(angle = 45, hjust = 1)), ...)

Arguments

data

input data

by

feature name to be fixed.

title

plot title

ggtheme

complete ggplot2 themes. The default is theme_gray.

theme_config

a list of configurations to be passed to theme.

other arguments to be passed to geom_point.

Details

To change default font family and size, you may pass base_size and base_family to ggtheme options, e.g., ggtheme = theme_gray(base_size = 15, base_family = "serif")

theme_config argument expects all inputs to be wrapped in a list object, e.g., to change the text color: theme_config = list("text" = element_text(color = "blue"))

See Also

geom_point

Examples

Run this code
# NOT RUN {
# Load mpg data from ggplot2
data("mpg", package = "ggplot2")

# Scatterplot mpg dataset by "hwy"
plot_scatterplot(mpg, "hwy", size = 1)

# Scatterplot mpg dataset by "class"
plot_scatterplot(mpg, "class", size = 1)

# Scatterplot with preset ggplot2 themes
library(ggplot2)
plot_scatterplot(mpg, "hwy", ggtheme = theme_light())

# Scatterplot with customized theme components
plot_scatterplot(mpg, "hwy", theme_config = list("axis.text.x" = element_text(angle = 90)))
# }

Run the code above in your browser using DataLab