pscontinuous: Position: continuous Add a continuous position scale to the...

Description Usage Arguments Format Details Examples

View source: R/scale-continuous.r

Description

There are a few useful things that you can do with pscontinuous:

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12

Arguments

plot

plot

variable

variable ("x" or "y")

name

namen of the scale (used in the legend)

transform

transform function and it's inverse in a vector

range

range, or leave missing to automatically determine

expand

expansion vector (numeric vector, multiplicative and additive expansion)

breaks

set breaks manually

Format

An object of class list of length 2.

Details

Note, that if you explicitly set the axis range, you may want to use expand_range to add a little extra room on each side.

When transforming an axes, you need to supply the transforming function and it's inverse (used to create pretty axis labels). I have created a few common ones for you:

Examples

1
2
3
4
5
6
7
p <- ggpoint(ggplot(mtcars, aesthetics=list(x=mpg, y=disp)))
pscontinuous(p, "x", range=c(20,30))
pscontinuous(p, "y", breaks=seq(100, 400, 50))
pscontinuous(p, "y", transform=trans_inverse)
pscontinuous(p, "x", transform=trans_sqrt)
pscontinuous(p, "x", transform=trans_log10)
pscontinuous(p, "x", transform=trans_log10, breaks=seq(10,30, 5))

hadley/ggplot1 documentation built on Aug. 19, 2019, 2:42 p.m.