ggstatsplot (version 0.0.2)

ggscatterstats: Scatterplot with marginal distributions

Description

Scatterplots from `ggplot2`` combined with add marginal histograms/boxplots/density plots with statistical details added as a subtitle.

Arguments

data

Dataframe from which variables specified are preferentially to be taken.

x

A vector containing the explanatory variable.

y

The response - a vector of length the number of rows of x.

xlab

Label for x axis variable.

ylab

Label for y axis variable.

line.colour

Colour for the regression line.

marginal

Decides whether ggExtra::ggMarginal() plots will be displayed; the default is TRUE.

marginal.type

Type of marginal distribution to be plotted on the axes ("histogram", "boxplot", "density", "violin").

xfill

Colour fill for x axis distibution (default: "orange").

yfill

Colour fill for y axis distribution (default: "green").

type

Type of association between paired samples required (""parametric": Pearson's product moment correlation coefficient" or ""nonparametric": Spearman's rho" or ""robust": Robust regression using an M estimator"). Corresponding abbreviations are also accepted: "p" (for parametric/pearson's), "np" (nonparametric/spearman), "r" (robust), resp.

results.subtitle

Decides whether the results of statistical tests are to be displayed as subtitle.

centrality.para

Decides which measure of central tendency ("mean" or "median") is to be displayed as vertical (for x) and horizontal (for y) lines.

title

The text for the plot title.

caption

The text for the plot caption.

maxit

Maximum number of iterations for robust linear regression or bootstrap samples to compute Spearman's rho confidence intervals (Default: 500).

k

Number of decimal places expected for results.

width.jitter

Degree of jitter in x direction. Defaults to 40% of the resolution of the data.

height.jitter

Degree of jitter in y direction. Defaults to 40% of the resolution of the data.

messages

Decides whether messages references, notes, and warnings are to be displayed (Default: TRUE).

Examples

Run this code
# NOT RUN {
# to get reproducible results from bootstrapping
set.seed(123)

#' # simple function call with the defaults
ggstatsplot::ggscatterstats(
data = datasets::mtcars,
x = wt,
y = mpg
)

# more detailed function call
ggstatsplot::ggscatterstats(
data = datasets::iris,
x = Petal.Length,
y = Sepal.Length,
centrality.para = 'median',
type = 'robust',
marginal.type = 'density'
)

# }

Run the code above in your browser using DataCamp Workspace