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

Is it possible to add counts on top of histogram bars? #157

Closed ramprasadn closed 2 years ago

ramprasadn commented 3 years ago

I usually find myself wanting to add labels of counts in marginal histograms, and the only way I know how to do that is by generating individual histograms with bar labels and then running something similar to the top answer in this thread to arrange the plots. I am not a big fan of this approach, as it clutters the plot area with redundant information like axis labels etc.,. Removing those elements however, messes up the alignment of the individual plots, which to me defeats the purpose of having marginal plots in the first place.

So I was wondering if there is a way to add count labels to histograms using ggExtra?

crew102 commented 3 years ago

Hi @ramprasadn , for something like that you'd probably just want to follow the approach that you linked to. ggMarginal kinda draws a line at including details like axis labels.