position_identityx: adjust identity position which can be shifted vertically or...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/position_identityx.r

Description

adjust identity position which can be shifted vertically or horizontally.

Usage

1
position_identityx(hexpand = NA, vexpand = NA)

Arguments

hexpand

numeric, distance to be shifted horizontally for geoms that have a position, default is NA.

vexpand

numeric, distance to be shifted vertically for geoms that have a position, default is NA.

Value

position method.

Author(s)

Shuangbin Xu

See Also

Other position adjustments: position_dodgex(), position_points_sinax()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library(ggplot2)
library(patchwork)
p <- ggplot(mtcars, aes(x=wt, y=mpg))
p1 <- p + geom_point(position=position_identityx()) + ylim(0, 50)
# whole point layer was shifted vertically (distance=5).
# the label of axis y should be subtracted 5 to get the true value..
p2 <- p + geom_point(position=position_identityx(vexpand=5)) + ylim(0, 50)
# whole point layer was shifted horizontally (distance=5).
# the label of axis x should be subtracted 5 to get the true value.
p3 <- ggplot(mtcars, aes(y=wt, x=mpg)) +
      geom_point(position=position_identityx(hexpand=5)) + xlim(0, 50)
p4 <- p1 + p2 + p3
p4

Example output



ggtreeExtra documentation built on April 8, 2021, 6:01 p.m.