Skip to content

Trying to plot only error bars (with no line connecting data points) results in empty plot #8117

Closed

Description

@anntzer

mpl2.0, regression from 1.5.3 and thus marked as release critical, but feel free to relabel/remilestone.

plt.errorbar([1, 1.6], [3, 4], [5, 6], capsize=2, fmt="none")

1.5.3
153

2.0
20

The error bars are not visible in 2.0. Further inspection indicates that they are, in fact, drawn with the same color as the data line (that connects each data point), i.e., (0, 0, 0, 0).

Note that the docstring of errorbar is a bit inconsistent (emphasis mine):

fmt : plot format string, optional, default: None
The plot format symbol. If fmt is 'none' (case-insensitive),
only the errorbars are plotted. This is used for adding
errorbars to a bar plot, for example.

ecolor : mpl color, optional, default: None
A matplotlib color arg which gives the color the errorbar lines;
if None, use the color of the line connecting the markers.

A strict reading of the doc for ecolor suggests that the current behavior is "correct", but the doc of fmt clearly indicates that this is not the intent.

Activity

  1. added
    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
    on Feb 21, 2017
  2. added this to the milestone on Feb 21, 2017
  3. tacaswell commented on Feb 23, 2017

    @tacaswell
    Member

    Agree this should be release critical (and my fault 😞 )

  4. self-assigned this
    on Feb 23, 2017
  5. dstansby commented on Feb 24, 2017

    @dstansby
    Member

    git-bisect tells me that this appeared in #5593

  6. dstansby commented on Feb 27, 2017

    @dstansby
    Member

    Just bumped into this doing day-to-day work - a workaround is

    plt.errorbar(x, y, fmt='none', ecolor=ebarcolor)

    where ebarcolor is the colour desired for the errorbars.

  7. dstansby commented on Feb 27, 2017

    @dstansby
    Member

    (re. doc inconsistency, the difference is None (not a string) and 'none' (a string))

  8. tacaswell commented on Feb 27, 2017

    @tacaswell
    Member

    what is the doc inconsistency between None and 'none'? I think we are pretty consistent about 'none' -> no style and None -> default style.

  9. dstansby commented on Feb 27, 2017

    @dstansby
    Member

    According to the code, using None is deprecated since 1.4 anyway:

        if fmt is None:
                fmt = 'none'
                msg = ('Use of None object as fmt keyword argument to ' +
                       'suppress plotting of data values is deprecated ' +
                       'since 1.4; use the string "none" instead.')
                warnings.warn(msg, mplDeprecation, stacklevel=1)
    
    
  10. tacaswell commented on Mar 13, 2017

    @tacaswell
    Member

    closed by #8163

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

Metadata

Metadata

Assignees

Labels

Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions