daattali / ggExtra

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

Problem reported by user: ggMarginal produces very different graph than it did previously #92

Closed daattali closed 6 years ago

daattali commented 6 years ago

A user claims their JSS paper got rejected partly because a figure they generated cannot be reproduced. Here is the old image they had:

image

And the new image that is incorrect when using new ggExtra (I don't know what version they used before):

image

I do not have a minimal reproducible example, but here is the code they provided:

set.seed(30)
df <- data.frame(x = runif(500, 0, 1), y = runif(500, 0.15, 1))

p1 <- ggplot2::ggplot(df, ggplot2::aes(x, y)) + ggplot2::geom_point()
ggMarginal(p1, type = "histogram")

p2 <- p1 + ylim(c(0, 1))

# The following is an example using "bamdit". You need to install JAGS to run the code

library("bamdit")
data("glas")
glas.t <- glas[glas$marker == "Telomerase", 1:4]
glas.m1 <- metadiag(glas.t,           # Data frame
                    re = "normal",             # Random effects distribution
                    re.model = "DS",         # Random effects on D and S
                    link = "logit",                # Link function
                    sd.Fisher.rho   = 1.7,   # Prior standard deviation of correlation
                    nr.burnin = 1000,        # Iterations for burnin
                    nr.iterations = 10000, # Total iterations
                    nr.chains = 2,               # Number of chains
                    r2jags = TRUE)            # Use r2jags as interface to jags
 plot(glas.m1,                                 # Fitted model
      level = c(0.5, 0.75, 0.95),        # Credibility levels
      parametric.smooth = TRUE,  # Parametric curve
      xlim = c(0, 0.9),
      ylim = c(0.25, 1))
crew102 commented 6 years ago

Probably related to #81 and friends. I should be able to close today.

daattali commented 6 years ago

fixed by @crew102