Lately I’ve been working with some data that is too copious to fit in memory, so I’ve had to write a wrapper for pyplot.hist that bins the data in chunks and then draws it like so:
pyplot.hist(x_edges, bins=100, weights=bin_contents, histtype=‘stepfilled’, facecolor=‘g’)
However, when I try to set the histogram’s y-scale to logarithmic the colors get all messed up (see attached). Any ideas? This is w/ matplotlib 0.99.0.
Thanks in advance.
import numpy as np
import matplotlib.pyplot as plt
generate some data on log-scale
x = 10**np.random.uniform(size=10000)
bin the data myself
bins, xed = np.histogram(x, bins=100, range=(0, 10))
plot the data as a weighted histo
plt.hist(np.linspace(0, 10, 100), bins=100, weights=bins, histtype=‘stepfilled’, facecolor=‘g’)