plot_sample: plot_sample

Description Usage Arguments Value Examples

Description

A friendly shortcut function that produces a good looking graph of a population sample. The main and lower part is composed of an histogram. The upper part is enriched with a marginal box plot.

Usage

1
2
3
plot_sample(sample, title = NULL, subtitle = NULL, caption = NULL,
  x_start = NULL, x_end = NULL, bins = NULL, x_scale_type = NULL,
  y_scale_type = NULL, variable_type = NULL, plot_addition = NULL, ...)

Arguments

sample

A vector of the population sample.

title

A title for the plot.

subtitle

A subtitle for the plot. Unfortunately, this is not yet supported with the non-dev version of GGPlot2, but should come soon.

caption

A caption for the plot. Unfortunately, this is not yet supported with the non-dev version of GGPlot2, but should come soon.

x_start

The left most position that will be displayed on the x axis. Overflowing values will be ignored.

x_end

The right most position that will be displayed on the x axis. Overflowing values will be ignored.

bins

The number of bins in the histogram.

x_scale_type

"Normal" (default) or "Log10".

y_scale_type

"Normal" (default) or "Log10".

variable_type

"Discrete" (default) or "Continuous".

plot_addition

Complementary plot objets to be added to the new plot object for enrichment purposes.
This parameter was originally introduced because ggMarginal function from ggExtra made it easy to enrich the plot with a boxplot on top of it, but the resulting plot could no longer be further enriched with additions. To overcome this limitation, I simply open the plot to arbitrary additions via this new parameter.

verbosity

0: no messages. > 0 more and more verbose messages.

Value

A good looking graph.

Examples

1
2
3
plot_sample(sample = rnorm(n = 10000), title = "Normal sample")
plot_sample(sample = rpois(n = 10000, lambda = exp(1)), title = "Poisson sample", variable_type = "Discrete")
plot_sample(sample = rgeom(n = 1000, p = .2), title = "Geometric sample", variable_type = "Discrete")

daviddoret/GRCRToolkit documentation built on May 23, 2019, 7:31 a.m.