Skip to content

Incorrect scale expansion with log scales #1696

Closed
@wch

Description

@wch

I haven't been able to make a super-minimal reproducible example, but here's one that uses real data:

library(ggplot2)
library(scales)

dat <- structure(list(nrow = c(10, 100, 1000, 10000, 1e+05, 10, 100, 
1000, 10000, 1e+05, 10, 100, 1000, 10000, 1e+05, 10, 100, 1000, 
10000, 1e+05, 10, 100, 1000, 10000, 1e+05, 10, 100, 1000, 10000, 
1e+05, 10, 100, 1000, 10000, 1e+05, 10, 100, 1000, 10000, 1e+05
), method = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 
3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 6L, 
6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L), .Label = c("apply", 
"split_lapply", "lapply_row", "lapply_lapply", "by_row", "pmap", 
"pmap_aslist", "rowwise"), class = "factor"), seconds = c(0, 
0.00400000000081491, 0.0059999999939464, 0.0659999999988941, 
0.921000000002095, 0.00100000000384171, 0.245000000002619, 0.0639999999984866, 
0.856999999996333, 35.1150000000052, 0.00100000000384171, 0.00700000000506407, 
0.0619999999980791, 0.833000000005995, 30.3260000000009, 0, 0.0029999999969732, 
0.0339999999996508, 0.471000000005006, 3.62299999999959, 0, 0.000999999996565748, 
0.00499999999738066, 0.0529999999998836, 0.594000000004598, 0.00400000000081491, 
0.00300000000424916, 0.0250000000014552, 0.273999999997613, 2.91700000000128, 
0, 0, 0.0029999999969732, 0.0169999999998254, 0.222000000001572, 
0.00200000000040745, 0.00600000000122236, 0.0639999999984866, 
0.588999999999942, 8.83099999999831)), row.names = c(NA, -40L
), .Names = c("nrow", "method", "seconds"), class = "data.frame")

ggplot(times, aes(x = nrow, y = seconds, colour = method)) +
  geom_point() +
  geom_line() +
  scale_y_continuous(trans = log10_trans()) +
  scale_x_continuous(trans = log10_trans())

image

Here's an attempt at a minimal example, but it doesn't reproduce the problem:

dat <- data.frame(x = 10^(1:10), y = 10^(1:10))

ggplot(dat, aes(x, y)) +
  geom_point() +
  scale_y_continuous(trans = log10_trans()) +
  scale_x_continuous(trans = log10_trans())

image

Metadata

Metadata

Assignees

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