daattali / ggExtra

📊 Add marginal histograms to ggplot2, and more ggplot2 enhancements
http://daattali.com/shiny/ggExtra-ggMarginal-demo/
Other
383 stars 45 forks source link

ggMarginal: when main plot is using log/sqrt/etc scale, marginal plots should also #11

Closed daattali closed 9 years ago

daattali commented 9 years ago

This isn't trivial because I don't know how to generalize looking for the current scale on a plot and using the same scale on another plot. I can manually check "is there a log x/y scale? if so, then add a log x/y scale to the margin plots" and repeat that for every common transformation. But not sure yet how to do it efficiently.

library(ggplot2)
library(ggExtra)
set.seed(123)
df <- data.frame(x = rlnorm(100), y = rlnorm(100))

p1 <- ggplot(df, aes(x, y)) + geom_point() + scale_x_log10() + scale_y_log10()
ggMarginal(p1, type = "histogram")
daattali commented 9 years ago

solved with eab490b7022ea872b6f86e8de3c4558e5c691a12