From: Jeff K. <kl...@wi...> - 2010-05-12 16:13:43
|
When creating a histogram with histtype='stepfilled' and log=True, the fill always ends up getting cut off diagonally. It looks like it's connection one datapoint with 10^-100 on the other side of the plot. So, also, it looks like it's always choosing 10^-100 as an arbitrary lower limit, which is another problem. Is this a known bug? Does anybody have ideas for an intelligent way to handle stepfilled log histograms? A working example is below, with the output plot attached. Thanks, Jeff || Jeff Klukas, Research Assistant, Physics || University of Wisconsin -- Madison || jeff.klukas@gmail | jeffyklukas@aim | jeffklukas@skype || http://www.hep.wisc.edu/~jklukas/ --------------------------------------------- #!/usr/bin/env python import numpy as np import matplotlib.mlab as mlab import matplotlib.pyplot as plt mu, sigma = 100, 15 x = mu + sigma*np.random.randn(10000) # the histogram of the data n, bins, patches = plt.hist(x, 50, normed=1, facecolor='green', alpha=0.75, log=True, histtype='stepfilled') plt.xlabel('Smarts') plt.ylabel('Probability') plt.title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$') plt.axis([40, 160, 0, 0.03]) plt.grid(True) plt.show() --------------------------------------------- |