divMult_trans | R Documentation |
Natural log transformation... providing breaks on the "divMult" scale
divMult_trans(n = 7, base = exp(1), splits = 2, slashStar = TRUE, ...)
n |
Scalar, target number of breaks |
base |
a positive or complex number: the base with respect to which
logarithms are computed. Defaults to |
splits |
Integer, one of |
slashStar |
Logical, should division and multiplication symbols be "*"
and "/" (default)? Prettier symbols |
... |
Additional arguments passed to breaking function, labeller |
Other transformations:
nel_trans()
,
propDiff_trans()
dat<-data.frame(x = 1:10, y = exp(-2:7))
dat %>% ggplot2::ggplot(ggplot2::aes(x, y)) +
ggplot2::geom_point() +
ggplot2::scale_y_continuous(
transform = "divMult"
# default breaks aren't perfect; sometimes adding more helps
# transform = nel_trans(n = 9)
, labels = label_divMult()
, sec.axis = ggplot2::sec_axis(
labels = function(x) {x}
, transform = ~.
, breaks = c(0.1, 0.5, 1, 5, 10, 50, 100, 500, 1000)
, name = "original scale"
)
) +
ggplot2::labs(y = "nel (natural log) scale") +
ggplot2::geom_hline(yintercept = 1, linewidth = 0.2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.