gg.plotHolder: gg.plotHolder

Description Usage Arguments Value Examples

Description

gg.plotHolder

Usage

1
gg.plotHolder(useArial = F, afmPATH = "~/Dropbox")

Arguments

useArial

Use the Arial font (requires .afm font files in the afmPath)

afmPATH

Path to Arial .afm font files.

Value

A blank ggplot2 object that can be used in concordance with grid.arrange.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Create a plot with marginal distributions.
library(ggplot2)
library(scales)

df <- data.frame(x = rnorm(n = 100), y = rnorm(n = 100),
                 group = factor(sample(x=c(0,1),
                 size = 100, replace = TRUE))
                 )

scatterP <- ggplot(df, aes(x = x, y =y, colour = group)) +
            geom_point() +
            gg.theme()

xDense <- ggplot(df, aes(x = x, fill = group)) +
          geom_density(aes(y= ..count..),trim=FALSE, alpha=.5) +
          gg.theme("noax") +
          theme(legend.position = "none")

yDense <- ggplot(df, aes(x = y, fill = group)) +
          geom_density(aes(y= ..count..),trim=FALSE, alpha=.5) +
          coord_flip() +
          gg.theme("noax") +
          theme(legend.position = "none")

library(gridExtra)

grid.arrange(xDense,
             gg.plotHolder(),
             scatterP,
             yDense,
             ncol=2, nrow=2,
             widths=c(4, 1.4), heights=c(1.4, 4)
             )

ManyLabsOpenScience/manylabRs documentation built on May 14, 2019, 5:21 p.m.