rewrote plot_histogram