The matplotlib hist
is actually just making calls to some other functions. It is often easier to use these directly allowing you to inspect the data and modify it directly:
# Generate some data
data = np.random.normal(size=1000)
# Generate the histogram data directly
hist, bin_edges = np.histogram(data, bins=10)
# Get the reversed cumulative sum
hist_neg_cumulative = [np.sum(hist[i:]) for i in range(len(hist))]
# Get the cin centres rather than the edges
bin_centers = (bin_edges[:-1] + bin_edges[1:]) / 2.
# Plot
plt.step(bin_centers, hist_neg_cumulative)
plt.show()
The hist_neg_cumulative is the array of data being plotted. So you can rescale is as you wish before passing it to the plotting function. This also doesn't plot the vertical line.