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

Don't plot empty bins? #134

Closed dstern closed 5 years ago

dstern commented 5 years ago

Dean Love the marginal histogram plots. I am plotting data with sparse distributions and would like to plot only bins that contain data. Here's an example image I am surprised it plots for empty bins, because just plotting with geom_histogram gives the histogram with empty bins not plotted. image Is there an easy, hidden way to not plot bins with missing data in marginal histograms ? Thanks, David

daattali commented 5 years ago

Hi David, I'm not quite sure where you see a problem there. Please provide sample input and code to reproduce the issue, and highlight where you see a problem. I'm not sure where in the marginal plots you see empty bins plotted that are not plotted in the geom_histogram, can you please clarify

dstern commented 5 years ago

Perhaps I was not clear. The top (blue) histogram contains the same data as the bottom (gray) histogram. In the blue histogram, bins with 0 counts are plotted as a solid line. I would like to remove this line so that only bins with values are visible. Perhaps this line is not technically a bin? In any case, I would love to be able to remove it.

daattali commented 5 years ago

Oh I see what you mean. That bottom line is not empty bins, it's just a border line that is always drawn. I don't remember the exact parameters but I don't think you can remove that line without digging into the source code

crew102 commented 5 years ago

Yeah, not possible to remove line without changing source code.

dstern commented 5 years ago

Thanks. I'll dig into the code and let you know if I come with anything useful.

daattali commented 5 years ago

You'll definitely be able to remove it by modifying the source code, it's just one (of the many!) theme options that are set. I'm closing this issue because this is not something that is going to change in the package. Feel free to ask for help if you're unable to find the exact option that sets this line