Skip to content

guide_axis_logticks() does not coordinate with minor axis breaks? #6016

Closed
r-lib/scales
#452
@clauswilke

Description

@clauswilke

I was playing around with guide_axis_logticks() and was surprised to find out it has no effect on the location of the minor breaks. I'm not sure about the implementation details (probably guides and breaks are completely independent) but conceptually this feels wrong. If I have a guide that sets log-ticks then I would expect it to set minor breaks also. Alternatively, if this can't be done, then it seems to me that the correct way to achieve log ticks would be to have a simple way to generate log minor breaks and then the ticks are had for free.

library(tidyverse)

data <- tibble(x = 0:40) |>
  mutate(
    y = exp(0.08 * x + 0.1 * rnorm(length(x)))
  )

ggplot(data, aes(x, y)) +
  geom_point() +
  theme_bw() +
  scale_y_log10(guide = guide_axis_logticks())

Created on 2024-07-27 with reprex v2.0.2

I found an old issue related to this: #1949 At the time we only had annotation_logticks() and I understand an annotation is independent from the minor breaks but with the guide rewrite and more flexible axis guides I think it's worth it to at least think about a more logically consistent approach.

I don't think there is any scenario in which one would ever want log-ticks together with regular minor tick lines. They just don't go together.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions