Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

BUG : errorbar does not respect `lines.linestyle` rcparam #2738

Closed
wants to merge 1 commit into from

2 participants

@tacaswell
Owner

changed default value of fmt from '-' -> ''

fixes issue #2366

Fix that does minimal amount of reverse compatible breakage.
I think the only scenario where this will be a problem are cases
where users have set a non-default value for lines.linestyle, but
do not want the lines drawn by errorbar to respect that. I think that
this use case is broken because lines.linestyle should be respected by
plotting functions which draw lines.

@tacaswell
Owner

Had this against master, changed my mind and put it against 1.3, and now I finished that I think it should be against master instead.

@tacaswell tacaswell BUG : errorbar does not respect `lines.linestyle` rcparam
changed default value of `fmt` from '-' -> ''

fixes issue #2366

Fix that does minimal amount of reverse compatible breakage.
I think the only scenario where this will be a problem are cases
where users have set a non-default value for `lines.linestyle`, but
do not want the lines drawn by `errorbar` to respect that.  I think that
this use case is broken because `lines.linestyle` should be respected by
plotting functions which draw lines.
5b60046
@efiring
Owner

This doesn't look right to me. First, I agree with @tacaswell that this should be a 1.4 change, not 1.3 (which might be futile anyway, if another 1.3.x never emerges). Second, the docstring needs to be changed to reflect the new behavior. To be consistent with mpl practice, I think it would be this:

  • fmt=None (default) do the default, which is passing "" to plot, hence using the line rc defaults
  • fmt='none' (case insensitive), don't plot the connecting lines (or markers)
  • otherwise pass fmt to plot as the usual third argument.

My suspicion is that the default (a connecting line, given the usual rcParams) is rarely what users will want; but correcting that is a bigger break with the past, and I'm not sure what the best default would be.

@efiring efiring referenced this pull request from a commit in efiring/matplotlib
@efiring efiring errorbar: handle fmt kwarg in a manner consistent with usual mpl prac…
…tice

Closes #2366, as an alternative to #2738.
b540b88
@tacaswell tacaswell closed this
@tacaswell tacaswell deleted the tacaswell:fix_errorbar_fmt_dflt branch
@efiring efiring referenced this pull request from a commit in efiring/matplotlib
@efiring efiring errorbar: fmt kwarg default is ''; deprecate None, use 'none' instead
Closes #2366, replaces #2738.
65a7ee7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 16, 2014
  1. @tacaswell

    BUG : errorbar does not respect `lines.linestyle` rcparam

    tacaswell authored
    changed default value of `fmt` from '-' -> ''
    
    fixes issue #2366
    
    Fix that does minimal amount of reverse compatible breakage.
    I think the only scenario where this will be a problem are cases
    where users have set a non-default value for `lines.linestyle`, but
    do not want the lines drawn by `errorbar` to respect that.  I think that
    this use case is broken because `lines.linestyle` should be respected by
    plotting functions which draw lines.
This page is out of date. Refresh to see the latest.
View
3  CHANGELOG
@@ -1,3 +1,6 @@
+2014-01-15 changed default value of `fmt` kwarg of `errorbar` from '-' -> '' so
+ that `errorbar` will respect `lines.linestyle` for drawing the line.
+
2013-05-18 Added support for arbitrary rasterization resolutions to the
SVG backend. Previously the resolution was hard coded to 72
dpi. Now the backend class takes a image_dpi argument for
View
10 doc/api/api_changes.rst
@@ -17,6 +17,16 @@ For new features that were added to matplotlib, please see
Changes in 1.3.x
================
+* changed default value of `fmt` kwarg of `errorbar` from `'-'` to
+ `''` so that `errorbar` will respect `lines.linestyle` for drawing
+ the line. I think the only scenario where this will break reverse
+ compatibility is cases where users have set a non-default value for
+ `lines.linestyle`, but do not want the lines drawn by `errorbar` to
+ respect that. I think that this use case is broken because
+ `lines.linestyle` should be respected by plotting functions which
+ draw lines.
+
+
Changes in 1.3.1
----------------
View
3  lib/matplotlib/axes.py
@@ -5484,7 +5484,7 @@ def pie(self, x, explode=None, labels=None, colors=None,
@docstring.dedent_interpd
def errorbar(self, x, y, yerr=None, xerr=None,
- fmt='-', ecolor=None, elinewidth=None, capsize=3,
+ fmt='', ecolor=None, elinewidth=None, capsize=3,
barsabove=False, lolims=False, uplims=False,
xlolims=False, xuplims=False, errorevery=1, capthick=None,
**kwargs):
@@ -5586,7 +5586,6 @@ def errorbar(self, x, y, yerr=None, xerr=None,
.. plot:: mpl_examples/statistics/errorbar_demo.py
"""
-
if errorevery < 1:
raise ValueError(
'errorevery has to be a strictly positive integer')
View
2  lib/matplotlib/pyplot.py
@@ -2679,7 +2679,7 @@ def csd(x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
# This function was autogenerated by boilerplate.py. Do not edit as
# changes will be lost
@_autogen_docstring(Axes.errorbar)
-def errorbar(x, y, yerr=None, xerr=None, fmt='-', ecolor=None, elinewidth=None,
+def errorbar(x, y, yerr=None, xerr=None, fmt='', ecolor=None, elinewidth=None,
capsize=3, barsabove=False, lolims=False, uplims=False,
xlolims=False, xuplims=False, errorevery=1, capthick=None,
hold=None, **kwargs):
Something went wrong with that request. Please try again.