GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Axes.hist(...log=True) mishandles y-axis minimum value · Issue #196 · matplotlib/matplotlib Closed DescriptionOriginal report at SourceForge, opened Thu Feb 24 15:32:30 2011 The pyplot.hist(..., log=True) method with histtype='step' (or 'stepfilled') does not properly handle bins with zero or negative contents. Instead of setting all invalid bin contents equal to the minimum valid bin contents, it sets them equal to the minimum bin edge. This mixes up data, using x-axis data to set the limits of the y axis. The following code demonstrates the bug in the upper and lower panels, while the middle one avoids it. The plot it produces is attached. Notice the weird diagonal filling at the corners and the incomplete filling of the main histogram. I chose histtype='stepfilled', because the problem is more visible this way, but it appears in 'step', too. I'm using matplotlib 1.0.1 on Darwin (Mac port library py26-matplotlib @1.0.1_2). This bug is related to 3032853, but it is different. (In fact, it's possible this problem arose when 3032853 was being worked on last summer.) The problem is in line 7747 of Axes.py, where minimum = min(bins) is inappropriate. I patched up my own copy by replacing that line with these two: ...but the choice of setting invalid contents to 0.1 times the lowest valid contents is pretty arbitrary. It certainly won't be a round number if the contents are normalized. Perhaps insiders have a better idea what to do here. import numpy Make random data; shift to ensure -2 as its minimum valuedata = numpy.random.standard_normal(2000) Two more sets where the minimum is guaranteed to be +.1000 and 30.1data_pos = data + 2.1 plt.clf() ax=plt.subplot(312) ax=plt.subplot(313) SourceForge History
Activity
MetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |