daattali / ggExtra

📊 Add marginal histograms to ggplot2, and more ggplot2 enhancements

Home Page:http://daattali.com/shiny/ggExtra-ggMarginal-demo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

ramprasadn opened this issue · comments

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?

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.