Description Usage Arguments Value Author(s) See Also Examples
Interpolation based scale transformations. The user supplies x and y (which should be monotonic increasing or decreasing in x) to create a scale transformation based on linear interpolation.
A ‘warp’ transformation is also supported wherein the user supplies x and w where, after sorting on x, the cumulative sum of w are used as the y in an interpolation transformation. Here w are the rate of increase, or ‘weights’.
1 2 3 |
x |
the x coordinates for linear interpolation. |
y |
the y coordinates for linear interpolation. |
data |
A |
na.rm |
If |
breaks |
default breaks function for this transformation. The breaks function is applied to the raw data. |
format |
default format for this transformation. The format is applied to breaks generated to the raw data. |
w |
the w coordinates for the ‘warp’ interpolation.
The cumulative sum of |
A scale transformation object.
Steven E. Pav shabbychef@gmail.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | set.seed(1234)
ggplot(data.frame(x=rnorm(100),y=runif(100)),aes(x=x,y=y)) +
geom_point() +
scale_x_continuous(trans=interp_trans(x=seq(-10,10,by=1),y=cumsum(runif(21))))
set.seed(1234)
ggplot(data.frame(x=rnorm(100),y=runif(100)),aes(x=x,y=y)) +
geom_point() +
scale_x_continuous(trans=warp_trans(x=seq(-10,10,by=1),w=runif(21)))
# equivalently:
set.seed(1234)
ggplot(data.frame(x=rnorm(100),y=runif(100)),aes(x=x,y=y)) +
geom_point() +
scale_x_continuous(trans=warp_trans(data=data.frame(x=seq(-10,10,by=1),w=runif(21))))
# this is like trans_sqrt:
set.seed(1234)
myx <- seq(0,5,by=0.01)
ggplot(data.frame(x=rnorm(100),y=runif(100)),aes(x=x,y=y)) +
geom_point() +
scale_y_continuous(trans=interp_trans(x=myx,y=sqrt(myx)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.