Learn R Programming

lvmisc (version 0.1.2)

plots: Quick plotting

Description

These functions are intended to be used to quickly generate simple exploratory plots using the package ggplot2.

Usage

plot_scatter(data, x, y, ...)

plot_line(data, x, y, ...)

plot_hist(data, x, bin_width = NULL, ...)

plot_qq(data, x, ...)

Value

A ggplot object.

Arguments

data

A data frame.

x, y

x and y aesthetics as the bare (unquoted) name of a column in data.

...

Additional arguments to be passed to the ggplot2::aes() function.

bin_width

The width of the bins in a histogram. When NULL (default), it uses the number of bins in bins (defaults to 30). You can also use one of the character strings "Sturges", "scott" or "FD" to use one of the methods to determine the bin width as in grDevices::nclass.*()

Examples

Run this code
plot_scatter(mtcars, disp, mpg, color = factor(cyl))
plot_line(Orange, age, circumference, colour = Tree)
plot_hist(iris, Petal.Width, bin_width = "FD")
plot_qq(mtcars, mpg)

Run the code above in your browser using DataLab