axis0: Adjust Space Between Axis in ggplot2

Description Usage Arguments References See Also Examples

Description

axis0 - Adjust Space Between x/y Axis in ggplot2.

x0 - Adjust Space Between x Axis in ggplot2.

y0 - Adjust Space Between y Axis in ggplot2.

Usage

1
2
3
4
5
axis0(max, scale = "continuous", axis = "y")

x0(max, scale = "continuous")

y0(max, scale = "continuous")

Arguments

max

The upper/right-most edge (upper ylim/xlim numeric value).

scale

A ggplot scale type (e.g. "continuous", "discrete", etc.)

axis

The axis to operate on ("x" or "y").

References

http://stackoverflow.com/a/20220737/1000343.

See Also

scale_y_continuous

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
ggplot(reorder_by(cyl, ~-cyl , mtcars, length), aes(x=as.factor(cyl))) +
    geom_bar()  +
    theme_apa() +
    y0(cushion(as.factor(mtcars$cyl))) +
    xlab("Cylinders") +
    ylab("Total")

library(dplyr)
mtcars2 <- mtcars %>% group_by(cyl) %>% summarise(n=length(cyl))
ggplot(mtcars2, aes(y=as.factor(cyl), x=n)) +
    geom_point()  +
    theme_apa() +
    x0(16)

ggplot(mtcars, aes(x=hp, y=mpg)) +
  geom_point()  +
  theme_apa() +
  x0(max(mtcars$hp) + 10) +
  y0(max(mtcars$mpg) + 5)

## End(Not run)

trinker/plotflow documentation built on May 31, 2019, 9:42 p.m.