-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behavior
Description
I want to use a log10 y scale for dollar amounts, and a second axis for € conversion, but I can't figure out how to make the second axis have the "nice" breaks automatically used on the original axis. I thought dup_axis
and the derive()
helper would do the trick, but apparently not.
library(ggplot2)
df <- data.frame(x = rep(c("A", "B", "C"), 100),
y = sample(c(20, 20e6, 1e6, 50, 100), 300, replace = TRUE))
ggplot(data = df, aes(x, y)) +
geom_boxplot() +
scale_y_log10(labels = scales::dollar, sec.axis = sec_axis(~.*0.85))
ggplot(data = df, aes(x, y)) +
geom_boxplot() +
scale_y_log10(labels = scales::dollar, sec.axis = dup_axis(~.*0.85))
packageVersion("ggplot2")
#> [1] '2.2.1.9000'
Created on 2018-07-03 by the reprex
package (v0.2.0).
Edit:
I have since tested this with ggplot2 v3.0.0 from CRAN, same result.
Please also see the discussion on community.rstudio.com
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behavior