Description Usage Arguments Details Value See Also Examples
Return vector of breaks that span the lims range evenly _after_ transformation
1 | power_breaks(lims, power, n_breaks = NULL)
|
lims |
The range for which breaks should be produced. |
power |
PARAM_DESCRIPTION |
n_breaks |
deprecated, does not influence the result. Stop using altogether. |
The breaks will be numbers that are powers of 2.
The base of 2 was chosen for three reasons.
Firstly, the resulting breaks are sufficiently dense (example: in the
[1,100]-interval, 2^x produces 2, 4, 8, 16, 32 and 64,
while 10^x only produces 1, 10 and 100, which is often rather sparse).
Secondly, for x>1 the powers of 2 are all integers (in contrast to 1.2^x, etc.).
And thirdly, 2^x are numbers familiar to many people, especially geeks and
scientists.
OUTPUT_DESCRIPTION
1 2 3 4 5 6 7 8 9 | ## Not run:
if(interactive()){
ggplot(data=diamonds, aes(price))+
geom_histogram(breaks=logseq(diamonds$price)) +
coord_trans(x=power_trans(1/2)) +
scale_x_continuous(breaks = function(lims) power_breaks(lims, 1/2))
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.