ggEasyPlots: Convenience functions for ggplots based on multiple variables

Description Usage Arguments Value Author(s) See Also Examples

Description

These are convenience functions to quickly generate plots for multiple variables, with the variables in the y axis.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
ggEasyRidge(data,
            items = NULL,
            labels = NULL,
            sortByMean = TRUE,
            xlab = NULL,
            ylab = NULL)

ggEasyBar(data,
          items = NULL,
          labels = NULL,
          sortByMean = TRUE,
          xlab = NULL,
          ylab = NULL,
          scale_fill_function =
            scale_fill_viridis(discrete = TRUE,
                               guide = guide_legend(title = NULL,
                                                    nrow=1)),
          fontColor = "white",
          fontSize = 2,
          labelMinPercentage = 1,
          showInLegend = "both")

Arguments

data

The dataframe containing the variables.

items

The variable names (if not provided, all variables will be used).

labels

Labels can optionally be provided; if they are, these will be used instead of the variable names.

sortByMean

Whether to sort the variables by mean value.

xlab, ylab

The labels for the x and y axes.

scale_fill_function

The function to pass to ggplot to provide the colors of the bars.

fontColor, fontSize

The color and size of the font used to display the labels

labelMinPercentage

The minimum percentage that a category must reach before the label is printed (in whole percentages, i.e., on a scale from 0 to 100).

showInLegend

What to show in the legend in addition to the values; nothing ("none"), the frequencies ("freq"), the percentages ("perc"), or both ("both"). This is only used if only one variable is shown in the plot; afterwise, after all, the absolute frequencies and percentages differ for each variable.

Value

A ggplot plot is returned.

Author(s)

Gjalt-Jorn Peters

Maintainer: Gjalt-Jorn Peters <[email protected]>

See Also

geom_ridgeline, geom_bar

Examples

1
2
ggEasyBar(mtcars, c('gear', 'carb'));
ggEasyRidge(mtcars, c('disp', 'hp'));

userfriendlyscience documentation built on Nov. 18, 2017, 4:14 a.m.