Skip to content

log_breaks Not Always Useful #168

@billdenney

Description

@billdenney

This is very similar to #100 but a more specialized case.

The second example below does not provide useful breaks (none show up when plotted). I like the "relevant_breaks" addition in #117, and similar code should be added to log_sub_breaks. If log_sub_breaks cannot find >= (n-2) breaks, then I think we should fall back to extended_breaks which has better guarantees of the number of relevant breaks even if we lose the equidistant log-scale spacing.

library(scales, quietly = TRUE)
(scales::log_breaks(base = exp(1)))(c(2, 2.0001))
#> [1] 1.000000 2.000000 2.718282
(scales::log_breaks(base = exp(1)))(c(2.0001, 2.0002))
#> [1] 2.000000 2.718282
(scales::extended_breaks())(c(2.0001, 2.0002))
#> [1] 2.000100 2.000125 2.000150 2.000175 2.000200

This affects many figures for me, so if possible to make it into 1.0.0, I think that would be selfishly beneficial (#157).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions