Manual merge of plotting_utils from hist branch