You can simply normalize your values variable like this:
unity_values = values / values.sum()
A complete example would look something like this:
import numpy as np import matplotlib.pyplot as plt x = np.random.normal(size=37) density, bins = np.histogram(x, normed=True, density=True) unity_density = density / density.sum() fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(nrows=2, ncols=2, sharex=True, figsize=(8,4)) widths = bins[:-1] - bins[1:] ax1.bar(bins[1:], density, width=widths) ax2.bar(bins[1:], density.cumsum(), width=widths) ax3.bar(bins[1:], unity_density, width=widths) ax4.bar(bins[1:], unity_density.cumsum(), width=widths) ax1.set_ylabel('Not normalized') ax3.set_ylabel('Normalized') ax3.set_xlabel('PDFs') ax4.set_xlabel('CDFs') fig.tight_layout()

Paul h
source share