Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
example where coord_trans throws many warnings
# from section 7.5.1 of ggplot2 book
library(ggplot2)
base <- ggplot(diamonds, aes(carat, price)) +
stat_bin2d() +
geom_smooth(method = "lm") +
xlab(NULL) +
ylab(NULL) +
theme(legend.position = "none")
pow10 <- scales::exp_trans(10)
base +
scale_x_log10() +
scale_y_log10() +
coord_trans(x = pow10, y = pow10) # <-- many warnings thrown here
# Warning messages:
# 1: In self$trans$x$inverse(panel_params$x.range) : NaNs produced
# 2: In self$trans$y$inverse(panel_params$y.range) : NaNs produced
# 3: In self$trans$x$inverse(panel_params$x.range) : NaNs produced
# 4: In self$trans$y$inverse(panel_params$y.range) : NaNs produced
# etc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.