1515rcParams = matplotlib .rcParams
1616
1717import matplotlib .cbook as cbook
18- from matplotlib .cbook import _string_to_bool
18+ from matplotlib .cbook import _string_to_bool , mplDeprecation
1919import matplotlib .collections as mcoll
2020import matplotlib .colors as mcolors
2121import matplotlib .contour as mcontour
@@ -2062,7 +2062,7 @@ def make_iterable(x):
20622062
20632063 errorbar = self .errorbar (x , y ,
20642064 yerr = yerr , xerr = xerr ,
2065- fmt = None , ** error_kw )
2065+ fmt = 'none' , ** error_kw )
20662066 else :
20672067 errorbar = None
20682068
@@ -2520,7 +2520,7 @@ def pie(self, x, explode=None, labels=None, colors=None,
25202520
25212521 @docstring .dedent_interpd
25222522 def errorbar (self , x , y , yerr = None , xerr = None ,
2523- fmt = '- ' , ecolor = None , elinewidth = None , capsize = 3 ,
2523+ fmt = '' , ecolor = None , elinewidth = None , capsize = 3 ,
25242524 barsabove = False , lolims = False , uplims = False ,
25252525 xlolims = False , xuplims = False , errorevery = 1 , capthick = None ,
25262526 ** kwargs ):
@@ -2530,7 +2530,7 @@ def errorbar(self, x, y, yerr=None, xerr=None,
25302530 Call signature::
25312531
25322532 errorbar(x, y, yerr=None, xerr=None,
2533- fmt='- ', ecolor=None, elinewidth=None, capsize=3,
2533+ fmt='', ecolor=None, elinewidth=None, capsize=3,
25342534 barsabove=False, lolims=False, uplims=False,
25352535 xlolims=False, xuplims=False, errorevery=1,
25362536 capthick=None)
@@ -2552,10 +2552,12 @@ def errorbar(self, x, y, yerr=None, xerr=None,
25522552 If a sequence of shape 2xN, errorbars are drawn at -row1
25532553 and +row2 relative to the data.
25542554
2555- *fmt*: '-'
2556- The plot format symbol. If *fmt* is *None*, only the
2557- errorbars are plotted. This is used for adding
2558- errorbars to a bar plot, for example.
2555+ *fmt*: [ '' | 'none' | plot format string ]
2556+ The plot format symbol. If *fmt* is 'none' (case-insensitive),
2557+ only the errorbars are plotted. This is used for adding
2558+ errorbars to a bar plot, for example. Default is '',
2559+ an empty plot format string; properties are
2560+ then identical to the defaults for :meth:`plot`.
25592561
25602562 *ecolor*: [ *None* | mpl color ]
25612563 A matplotlib color arg which gives the color the errorbar lines;
@@ -2635,6 +2637,15 @@ def errorbar(self, x, y, yerr=None, xerr=None,
26352637 holdstate = self ._hold
26362638 self ._hold = True
26372639
2640+ if fmt is None :
2641+ fmt = 'none'
2642+ msg = ('Use of None object as fmt keyword argument to '
2643+ + 'suppress plotting of data values is deprecated '
2644+ + 'since 1.4; use the string "none" instead.' )
2645+ warnings .warn (msg , mplDeprecation , stacklevel = 1 )
2646+
2647+ plot_line = (fmt .lower () != 'none' )
2648+
26382649 label = kwargs .pop ("label" , None )
26392650
26402651 # make sure all the args are iterable; use lists not arrays to
@@ -2655,7 +2666,9 @@ def errorbar(self, x, y, yerr=None, xerr=None,
26552666
26562667 l0 = None
26572668
2658- if barsabove and fmt is not None :
2669+ # Instead of using zorder, the line plot is being added
2670+ # either here, or after all the errorbar plot elements.
2671+ if barsabove and plot_line :
26592672 l0 , = self .plot (x , y , fmt , label = "_nolegend_" , ** kwargs )
26602673
26612674 barcols = []
@@ -2838,7 +2851,7 @@ def xywhere(xs, ys, mask):
28382851 xup , yup = xywhere (x , y , uplims & everymask )
28392852 caplines .extend (self .plot (xup , yup , 'k_' , ** plot_kw ))
28402853
2841- if not barsabove and fmt is not None :
2854+ if not barsabove and plot_line :
28422855 l0 , = self .plot (x , y , fmt , ** kwargs )
28432856
28442857 if ecolor is None :
0 commit comments