nplots_violin: nplots_violin : Generate violin plots using ggplot2

Description Usage Arguments Details Value Examples

View source: R/nplots_violin.R

Description

This function takes your plot arguments like the data, aesthetics, plot layers and labels and creates a violin plot for you using ggplot2. You don't have to worry about writing a bunch of lines of code. This function takes care ofthat for you!

Usage

1
2
3
nplots_violin(x, y_variable, factor, jitter = TRUE, order = TRUE,
  xlab = "", ylab = "", title = "", plotly = TRUE, alpha = 0.05,
  hjust = 0.5)

Arguments

x

The dataset to be used

y_variable

y-axis variable for the violin plot

factor

the factor variable to be used in the violin plot

jitter

argument to specify whether jitter should be included in plot - supply arguments TRUE of FALSE

order

argument to specify whether factor reorder should be applied to a plot - supply arguments TRUE of FALSE

xlab

argument to specify x axis label

ylab

argument to specify y axis label

title

argument to specify the plot title to be applied

plotly

argument to specify whether the genereated plot should be rendered as a plotly plot

alpha

argument to specify geom_poin opacity or transparency magnitude

hjust

argument to specify horizontal justification of the plot title

Details

This function takes plot the specified plot arguments and produces a violin plot using - nplots_violin with the background machinery being ggplot2. Future versions of this function will provide an inclusion of other plot layers and objects to work with.

Value

violin plot

Examples

1
2
\code {nplots_violin(gapminder, gapminder$gdpPercap, gapminder$continent, jitter=TRUE, order=TRUE, xlab="Continent", ylab="gdpPercap", title="gdpPercap across continents", plotly=TRUE, alpha=0.05, hjust=0.5)}
\code {nplots_violin(iris, iris$Sepal.Width, iris$Species, jitter=FALSE, order=TRUE, xlab="Sepal.Width", ylab="Sepal.Length", title="Sepal Width Vs Length", plotly=FALSE)}

STAT545-UBC-students/hw07-rasiimwe documentation built on May 5, 2019, 7:07 a.m.