grid_arrange_shared_legend: Function to combine multiple ggplot graphs in a panel,

Description Usage Arguments Examples

View source: R/grid_arrange_shared_legend.R View source: R/create_linefigures_panel.R

Description

This functions plots multiple plots in a panel, keeping only the fist legend of the fist plot keeping only the legend of the first plot

This functions plots multiple plots in a panel, keeping only the fist legend of the fist plot keeping only the legend of the first plot

Usage

1
2
3
4
5
grid_arrange_shared_legend(..., ncol = length(list(...)), nrow = 1,
  position = c("bottom", "right"))

grid_arrange_shared_legend(..., ncol = length(list(...)), nrow = 1,
  position = c("bottom", "right"))

Arguments

...

additional parameters to ggplot

ncol

Number of columns in the panel, defaults to the number of plots in the plotlist

nrow

Number of row, defaults to 1

position

Legend position, defaults to c("bottom" , "right")

ncol

Number of columns in the panel, defaults to the number of plots in the plotlist

...

additional parameters to ggplot

nrow

Number of row, defaults to 1

position

Legend position, defaults to c("bottom" , "right")

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
p1 <- qplot(carat, price, data = dsamp, colour = clarity)
p4 <- qplot(depth, price, data = dsamp, colour = clarity)
grid_arrange_shared_legend(p1, p2, p3, p4, ncol = 4, nrow = 1)
scale_linetype_manual(values=c("solid",
          "dotted", "longdash", "dotdash", "dashed"))

dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
p1 <- qplot(carat, price, data = dsamp, colour = clarity)
p4 <- qplot(depth, price, data = dsamp, colour = clarity)
grid_arrange_shared_legend(p1, p2, p3, p4, ncol = 4, nrow = 1)
scale_linetype_manual(values=c("solid",
          "dotted", "longdash", "dotdash", "dashed"))

uashogeschoolutrecht/citrulliner documentation built on Dec. 12, 2020, 7:12 a.m.