modified histogram function to reduce necessary inputs (should save processing time by not requiring R to reload the data for each histogram