FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Autoscale in hist() with step and log · Issue #159 · matplotlib/matplotlib · GitHub

Repository navigation

Autoscale in hist() with step and log #159

Closed

Description

Original report at SourceForge, opened Tue Jun 22 07:58:14 2010

The autoscale seems to be broken in trunk in this example:

from pylab import *
hist(rand(100),bins=20,histtype="step",log=1)

SourceForge Comments

On Wed Aug 4 10:24:05 2010, None wrote:

Sorry for not being explicit enough. The lower y-limit was previously set to a value closer to the lowest non-zero bin, and not 1E-100.

That being said, the behaviour in rev 8623 is actually sane again.

On Tue Jul 6 15:17:38 2010, mdboom wrote:

Can you be more specific about what you would have expected to see?

On Tue Jun 29 08:05:07 2010, None wrote:

Uploaded the plot that I get here, from rev 8475.

On Thu Jun 24 10:51:32 2010, mdboom wrote:

In what way is it broken? The axes appears to contain all of the data. Some of the lines are right under the axes line at the top, but that is expected behavior. If you want some "padding", that would have to be added manually.

SourceForge History

  • On Tue Jun 29 03:22:58 2010, by None: File Added: 378710: image.png

Activity

  1. dmcdougall commented on Sep 23, 2012

    Member

    Here's a script plotting steps and bars:

    In [1]: import matplotlib
    
    In [2]: matplotlib.use('agg')
    
    In [3]: import matplotlib.pyplot as plt
    
    In [4]: fig = plt.figure()
    
    In [5]: ax = fig.add_subplot(2, 1, 1)
    
    In [6]: import numpy as np
    
    In [7]: ax.hist(np.random.rand(100), histtype='step', log=1)
    Out[7]: 
    (array([10, 12,  2,  8, 11,  7, 12, 15, 11, 12]),
     array([ 0.00352264,  0.10181859,  0.20011454,  0.2984105 ,  0.39670645,
            0.4950024 ,  0.59329835,  0.6915943 ,  0.78989025,  0.8881862 ,
            0.98648216]),
     <a list of 1 Patch objects>)
    
    In [8]: ax2 = fig.add_subplot(2, 1, 2)
    
    In [9]: ax2.hist(np.random.rand(100), log=1)
    Out[9]: 
    (array([11,  8, 13,  6,  9,  6, 16, 10, 12,  9]),
     array([ 0.00454384,  0.10397154,  0.20339924,  0.30282694,  0.40225465,
            0.50168235,  0.60111005,  0.70053775,  0.79996545,  0.89939315,
            0.99882086]),
     <a list of 10 Patch objects>)
    
    In [10]: fig.savefig('hists.png')
    
    In [11]: !open hists.png

    And here's sample output:

    I don't think there's anything wrong. As @mdboom pointed out in the original email, the axes contain all the data. Perhaps the in the case where histtype='step' we could handle the trailing bin edges better, by setting ylim such that the y-axis in each plot is the same, but I'd think that was for eye-candy?

    I think this issue can probably be closed, but I'll leave it open for a few days just in case I'm missing something.

  2. pelson commented on Sep 23, 2012

    Member

    While the ranges are different, neither look "broken". We don't have an end user for this one, so I would second your assertion that this can be closed.

  3. dmcdougall commented on Sep 23, 2012

    Member

    @pelson Thanks. I thought as much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL