GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Autoscale in hist() with step and log · Issue #159 · matplotlib/matplotlib

Autoscale in hist() with step and log #159

New issue
Copy link
New issue
Copy link
Closed
Closed
Autoscale in hist() with step and log#159
Copy link

Description

@ddale
ddale
opened on Jun 20, 2011
Issue body actions

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

    @dmcdougall
    dmcdougall
    on Sep 23, 2012
    Member
    More actions

    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:

    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

    @pelson
    pelson
    on Sep 23, 2012
    Member
    More actions

    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

    @dmcdougall
    dmcdougall
    on Sep 23, 2012
    Member
    More actions

    @pelson Thanks. I thought as much.

  4. dmcdougall
    closed this as completedon Sep 23, 2012
  5. anntzer
    added a commit that references this issue on Dec 14, 2019

    Raise an ValueError when Axes.pie accepts negative values #159… (#15935)

    b12c761
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

      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.