Stacked histogram with bivariate colored bars in R

A histogram gives you counts of elements within spefic ranges of a variable, represented as bars. Sometimes, you want to see more then bars. The following code allows you to represent a second variable with a color shade: library(ggplot2) library(data.table) # create an example of a table d <- data.table( slope = round(rnorm(50),50), p = […]