Closed peterolejua closed 6 years ago
Hi Peter, ggMarginal()
requires that the main plot is a scatter plot (and not a histogram, as you have there). I'm not sure why/how it would have worked for you in the past.
Well I did it in the past like this:
qu <- quantile(estancia.uci)
c <- ggplot(data = uci, aes(estancia.uci)) +
geom_histogram(breaks=seq(0, 2000, by =30),fill='lightblue',closed='left')+
xlab("# Días")+
ylab("# Pacientes")+
labs(colour="",
title="Tiempo de estancia en la UCI")+
geom_vline(data= uci, xintercept= qu,linetype = 3,colour = "Red")+
scale_x_continuous(breaks = seq(0,2000,200))+
scale_y_continuous(breaks = seq(0,30,2))+
theme_bw()
d <- ggMarginal(c, type = "boxplot", fill="lightblue",colour='blue',margins='x',size=30)
tiff('estancia.tiff',width = 720)
d
dev.off()
and it gave me this:
It would be great if your function could to do it again,
Thank you very much!
Hi Peter, It's interesting that this used to work for you, because it was never an intended feature. The documentation and examples were always explicit in saying that this function adds marginal plots to scatter plots. I'm sorry that histograms aren't supported any longer, if I had known that they worked in the past I would have added a comment saying this behaviour may not remain forever. Unfortunately because this is meant to be a supported feature, I'm going to close this issue. I hope it's not breaking anything extremely critical for you. If you must still use this "feature", you can re-install an old version. Again, sorry for the inconvenience!
Hello I want a marginal boxplot to a histogram. Like a year ago I could do it with the same code below
Clearly the boxplot doesn´t correspond to what it is supposed to. I appreciate any help.
Best regards,
Peter