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 — Problem with errorbar in log scale · Issue #163 · matplotlib/matplotlib

Problem with errorbar in log scale #163

New issue
Copy link
New issue
Copy link
Closed
#2147
Closed
Problem with errorbar in log scale#163
#2147
Copy link
Labels
status: confirmed bugstatus: needs clarificationIssues that need more information to resolve.Issues that need more information to resolve.

Description

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

Original report at SourceForge, opened Wed Sep 1 13:52:54 2010

When using log scale, if the error is larger than flux, the error bar does not plot at all:

import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.errorbar([1.],[1.],yerr=[2.])
ax.set_yscale('log')
fig.savefig('test.png')

However, I think it would make more correct to plot the line for the errorbar, and to make it go down to -infinity.

Activity

  1. M-funk commented on Mar 19, 2012

    @M-funk
    M-funk
    on Mar 19, 2012
    More actions

    The error bar does plot, but for some reason, it doesn't show the vertical connecting bar. You'll see if you do this:

    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.errorbar([1.,2.,3.],[1.,1.,1.],yerr = [0.1,3.,0.4])
    ax.set_yscale('log')
    fig.savefig('test.png')

    something like this outputs:
    http://i.imgur.com/LOIi7.png

    I think the problem lies in the fact that numpy computes log(1), in any base, equal to 0

  2. pelson commented on Aug 19, 2012

    @pelson
    pelson
    on Aug 19, 2012
    Member
    More actions

    Confirming. Pretty sure this is related to the fact that you are trying to plot an error bar down to log(0). This works if your not trying log(0). For instance:

    ax.errorbar([10, 11, 12], [8, 9, 10], yerr=[0.5, 0.7, 0.9])
    

    Looks fine. @M-funk: can you confirm what you are expecting to see? I can't see that there is an action on this issue (perhaps a warning might be suitable when you are at log(0))?

  3. neggert commented on Mar 18, 2013

    @neggert
    neggert
    on Mar 18, 2013
    Contributor
    More actions

    This can be worked around by doing

    ax.set_yscale('log', nonposy="clip")
    

    Maybe this should be the default for set_yscale? This seems to cause quite a few problems.

  4. kreczko commented on May 13, 2013

    @kreczko
    kreczko
    on May 13, 2013
    More actions

    @neggert : Nice workaround.
    Wish I had seen it before I wasted 1 hour to try and fix it ;)

    From a beginners standpoint I would definitely vote for making it the default (unless there are obvious reasons not to do so).

  5. mdboom commented on May 13, 2013

    @mdboom
    mdboom
    on May 13, 2013
    Member
    More actions

    👍 on making the default clip, with the appropriate API change warning.

  6. dmcdougall
    closed this as completedin #2147on Aug 18, 2013
  7. SebastianoF commented on Jan 24, 2019

    @SebastianoF
    SebastianoF
    on Jan 24, 2019
    More actions

    Uhm... No, the errorbar should not be asymmetric when passing in log scale.
    Please consider
    http://faculty.washington.edu/stuve/uwess/log_error.pdf
    If I understood correctly the documentation, I would consider nonposx="mask" as the best option of the default behavour.

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

    status: confirmed bugstatus: needs clarificationIssues that need more information to resolve.Issues that need more information to resolve.

    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.