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

Adding y-axis labels on the marginal plots #64

Open lavkan opened 7 years ago

lavkan commented 7 years ago

Hi,

I would like to add y-axis labels for the marginal plots. Is there a way to do it using ggMarginal command?

Thanks, Lavanya

daattali commented 7 years ago

There is no way to do that, the axis labels on the marginal plots are purposely explicitly suppressed. If you absolutely need them, you can modify the source code to NOT remove the labels

lavkan commented 7 years ago

It makes sense to remove the axis that are shared, but what about the other axis of these plots? For example, the x-axis of the marginal plot on the top is removed. However, I want the y-axis along with its units printed. I also want to add the y-axis label "count". If there is a way to add this in the ggMarginal function, it would be greatly helpful for the users. Thanks.

daattali commented 7 years ago

I suppose that could make sense for histograms. I don't think I will implement this parameter, but I will leave the issue open so that someone in the future could add support for it

bencneely commented 5 years ago

I'm in agreement with lavkan. I was asked by a reviewer to succinctly display sample size. A histogram worked great to display distribution in the margin, but I'm still lacking magnitude. Being able to add y-axis counts on histograms would be beneficial, in my opinion. Thanks for a great package!

daattali commented 5 years ago

@bencneely feel free to submit a pull request if you want to work on this!

davidizquierdogomez commented 4 years ago

I'm in agreement with lavkan. I was asked by a reviewer to succinctly display sample size. A histogram worked great to display distribution in the margin, but I'm still lacking magnitude. Being able to add y-axis counts on histograms would be beneficial, in my opinion. Thanks for a great package!

yes, that's my case as well. I'm a reviewer in this case and I fully recommend the axis of marginal plots...

daattali commented 4 years ago

I understand that can be a useful feature. I would welcome anyone who wants to tackle this feature and implement it - I'll very happily accept that feature

davidizquierdogomez commented 4 years ago

Thanks you your answer. I would like to but I'm an experienced beginner so it'll be a bit difficult to do it for the moment but maybe in the future ;D

ms-gx commented 3 years ago

@daattali can you tell me where I have to modify your code in order to show the y-axis for histogram marginal plots?

daattali commented 3 years ago

@ms-gx I haven't touched the core functionality of this package in 3+ years so I can't tell you. It would need to be found out by walking through the code, with a debugger perhaps

crew102 commented 3 years ago

Hey @ms-gx , here's where the main plot grab associated with the histogram is pulled out of the marginal plot, leaving behind all of the axis grobs. You'd have to edit this code so that the axis grobs are pulled out along with the main plot grob.

https://github.com/daattali/ggExtra/blob/5d51a7fa02de21f81e13bb705a4b40d8e7f9259e/R/ggMarginal-helpers.R#L68-L108

ms-gx commented 3 years ago

@crew102 Thanks so much! I tried, but couldn't figure it out. So I might have to use another package for marginal plots or just leave it as it is.

Thanks again.