add functions for histogram