xgx_breaks_log10
sets nice breaks for log10 scale.
it's better than the default function because it ensures there is at least
2 breaks
and also, it will try to go by 3s (i.e. 1,3,10,30,100) if it makes sense
xgx_breaks_log10(data_range)
range of the data
numeric vector of breaks
for the extended breaks function, weights is a set of 4 weights for
simplicity - how early in the Q order are you
coverage - labelings that don't extend outside the data: range(data) / range(labels)
density (previously granularity) - how close to the number of ticks do you get (default is 5)
legibility - has to do with fontsize and formatting to prevent label overlap
Talbot, Justin, Sharon Lin, and Pat Hanrahan. "An extension of Wilkinson’s algorithm for positioning tick labels on axes." IEEE Transactions on visualization and computer graphics 16.6 (2010): 1036-1043.
xgx_breaks_log10(c(1, 1000))
#> [1] 1 10 100 1000
xgx_breaks_log10(c(0.001, 100))
#> [1] 1e-03 1e-02 1e-01 1e+00 1e+01 1e+02
xgx_breaks_log10(c(1e-4, 1e4))
#> [1] 1e-04 1e-02 1e+00 1e+02 1e+04
xgx_breaks_log10(c(1e-9, 1e9))
#> [1] 1e-10 1e-05 1e+00 1e+05 1e+10
xgx_breaks_log10(c(1, 2))
#> [1] 1 2
xgx_breaks_log10(c(1, 5))
#> [1] 1 2 3 4 5
xgx_breaks_log10(c(1, 10))
#> [1] 1 2 3 4 6 10
xgx_breaks_log10(c(1, 100))
#> [1] 1 3 10 30 100
xgx_breaks_log10(c(1, 1.01))
#> [1] 1.00 1.01
xgx_breaks_log10(c(1, 1.0001))
#> [1] 1.000000 1.000023 1.000046 1.000069 1.000092
print(xgx_breaks_log10(c(1, 1.000001)), digits = 10)
#> [1] 1.000000000 1.000000230 1.000000461 1.000000691 1.000000921