adapted for plotting hist and histdist