Creating a conditional histogram