interp_trans {ggallin} | R Documentation |
Interpolation based scale transforms.
Description
Interpolation based scale transformations. The user supplies and
(which should be monotonic increasing or decreasing in
)
to create a scale transformation based on linear interpolation.
A ‘warp’ transformation is also supported wherein the user supplies
and
where, after sorting on
, the cumulative sum
of
are used as the
in an interpolation transformation.
Here
are the rate of increase, or ‘weights’.
Usage
interp_trans(x=NULL,y=NULL,data=NULL,na.rm=TRUE,breaks=NULL,format=NULL)
warp_trans(x=NULL,w=NULL,data=NULL,na.rm=TRUE,breaks=NULL,format=NULL)
Arguments
x |
the |
y |
the |
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 |
Value
A scale transformation object.
Author(s)
Steven E. Pav shabbychef@gmail.com
See Also
Examples
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)))