ggExtra icon indicating copy to clipboard operation
ggExtra copied to clipboard

Adding y-axis labels on the marginal plots

Open lavkan opened this issue 7 years ago • 12 comments

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

lavkan avatar Sep 13 '17 16:09 lavkan

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

daattali avatar Sep 13 '17 19:09 daattali

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.

lavkan avatar Sep 13 '17 19:09 lavkan

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

daattali avatar Sep 14 '17 05:09 daattali

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!

bencneely avatar Jun 10 '19 16:06 bencneely

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

daattali avatar Jun 10 '19 17:06 daattali

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...

davidizquierdogomez avatar Feb 13 '20 23:02 davidizquierdogomez

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

daattali avatar Feb 14 '20 01:02 daattali

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

davidizquierdogomez avatar Feb 14 '20 06:02 davidizquierdogomez

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

ms-gx avatar Jul 03 '21 22:07 ms-gx

@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

daattali avatar Jul 04 '21 12:07 daattali

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

crew102 avatar Jul 05 '21 18:07 crew102

@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.

ms-gx avatar Jul 06 '21 09:07 ms-gx