trans_composition | R Documentation |
trans_composition()
derives a transformation from a numerical vector with a smaller number (ideally < 30) of distinct values.
The return can be used with function ggplot::scale_x_continuous()
or ggplot::scale_y_continuous()
to create a desired axis.
trans_composition(x = NULL, nb = 30, brk = NA, dab = NA, dgrd = NA, dgrd2 = NA)
x |
A numerical vector used in a plot as (typically) |
nb |
An integer for the maximum number of breaks. Default=30 |
brk |
One of
|
dab |
One of
|
dgrd |
One of
|
dgrd2 |
One of
|
A transformation function
library(ggplot2)
pdt=data.frame(x=rep(c(0.5, 1, 10,11,12, 100, 1000), each=5))
pdt$y=pdt$x+rnorm(length(pdt$x))
t=trans_composition(pdt$x,brk=50, dab=3)
ggplot(pdt, aes(x=x, y=y))+geom_point()+scale_x_continuous(trans=t)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.