1212
1313from collections import defaultdict
1414from functools import reduce
15+ import logging
1516import math
1617import textwrap
1718
2526import matplotlib .docstring as docstring
2627import matplotlib .scale as mscale
2728from matplotlib .axes import Axes , rcParams
28- from matplotlib .axes ._base import _axis_method_wrapper
29+ from matplotlib .axes ._base import _axis_method_wrapper , _process_plot_format
2930from matplotlib .transforms import Bbox
3031from matplotlib .tri .triangulation import Triangulation
31- from matplotlib .colors import Normalize , LightSource
32- from matplotlib .axes ._base import _process_plot_format
3332
3433from . import art3d
3534from . import proj3d
3635from . import axis3d
3736
37+ _log = logging .getLogger (__name__ )
38+
3839
3940@cbook .deprecated ("3.2" , alternative = "Bbox.unit()" )
4041def unit_bbox ():
@@ -2846,19 +2847,19 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
28462847 """
28472848 had_data = self .has_data ()
28482849
2849- if not cbook .iterable (x ):
2850+ if not np .iterable (x ):
28502851 x = [x ]
2851- if not cbook .iterable (y ):
2852+ if not np .iterable (y ):
28522853 y = [y ]
2853- if not cbook .iterable (z ):
2854+ if not np .iterable (z ):
28542855 z = [z ]
28552856
28562857 if fmt is None :
28572858 fmt = 'none'
28582859 msg = ('Use of None object as fmt keyword argument to ' +
28592860 'suppress plotting of data values is deprecated ' +
28602861 'since 1.4; use the string "none" instead.' )
2861- warnings . warn (msg )
2862+ _log . warning (msg )
28622863
28632864 plot_line = (fmt .lower () != 'none' )
28642865 label = kwargs .pop ("label" , None )
@@ -2873,7 +2874,7 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
28732874 if 'color' in kwargs :
28742875 base_style ['color' ] = kwargs .pop ('color' )
28752876 else :
2876- base_style = six . next (self ._get_lines .prop_cycler )
2877+ base_style = next (self ._get_lines .prop_cycler )
28772878
28782879 base_style .update (fmt_style_kwargs )
28792880 if 'color' not in base_style :
@@ -2936,10 +2937,10 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
29362937 self .add_line (data_line )
29372938
29382939 def _bool_asarray_helper (d , expected ):
2939- if not cbook .iterable (d ):
2940+ if not np .iterable (d ):
29402941 return np .asarray ([d ] * expected , bool )
2941- else :
2942- return np .asarray (d , bool )
2942+
2943+ return np .asarray (d , bool )
29432944
29442945 def _mask_lists (xs , ys , zs , mask = None ):
29452946 """ Applies a mask to three lists. """
@@ -2958,14 +2959,14 @@ def _unpack_errs(data, err, lomask, himask):
29582959 # List of endpoint coordinates, used for auto-scaling
29592960 coorderrs = []
29602961
2961- for data , err , i_xyz , lolims , uplims in zip ([ x , y , z ],
2962- [xerr , yerr , zerr ], range (3 ),
2963- [xlolims , ylolims , zlolims ],
2964- [ xuplims , yuplims , zuplims ]):
2962+ for data , err , i_xyz , lolims , uplims in zip (
2963+ [ x , y , z ], [xerr , yerr , zerr ], range (3 ),
2964+ [xlolims , ylolims , zlolims ], [ xuplims , yuplims , zuplims ]):
2965+
29652966 if err is None :
29662967 continue
29672968
2968- if not cbook .iterable (err ):
2969+ if not np .iterable (err ):
29692970 err = [err ] * len (data )
29702971 lolims = _bool_asarray_helper (lolims , len (x ))
29712972 uplims = _bool_asarray_helper (uplims , len (x ))
@@ -2976,17 +2977,18 @@ def _unpack_errs(data, err, lomask, himask):
29762977 # as long as the actual data plotted stays as lists.
29772978 # This is due to unit preservation issues
29782979 # (c.f. the 2d errorbar case).
2979- rolling_mask = np .roll ([1. ,0. ,0. ], i_xyz )
2980+ rolling_mask = np .roll ([1. , 0. , 0. ], i_xyz )
29802981 # TODO: why is this here?
29812982 if err is not None :
29822983 err = np .atleast_1d (err )
29832984
29842985 # a nested list structure that expands to (xl,xh),(yl,yh),(zl,zh),
29852986 # where x/y/z and l/h correspond to dimensions and low/high
29862987 # positions of errorbars in a dimension we're looping over
2987- coorderr = [_unpack_errs (coord , err * rolling_mask [i ],
2988- ~ lolims & everymask , ~ uplims & everymask )
2989- for i , coord in enumerate ([x , y , z ])]
2988+ coorderr = [
2989+ _unpack_errs (coord , err * rolling_mask [i ],
2990+ ~ lolims & everymask , ~ uplims & everymask )
2991+ for i , coord in enumerate ([x , y , z ])]
29902992 (xl , xh ), (yl , yh ), (zl , zh ) = coorderr
29912993
29922994 # define the markers used for errorbar caps and limits below
@@ -3026,8 +3028,9 @@ def _unpack_errs(data, err, lomask, himask):
30263028 # example, 180 deg rotation around z-axis would flip
30273029 # the markers around... However, this solution is
30283030 # spiritually close to that of 2d errorbar function
3029- limits = [_unpack_errs (coord , err * rolling_mask [i ], uplims ,
3030- lolims ) for i , coord in enumerate ([x , y , z ])]
3031+ limits = [
3032+ _unpack_errs (coord , err * rolling_mask [i ], uplims , lolims )
3033+ for i , coord in enumerate ([x , y , z ])]
30313034 (xlo , xup ), (ylo , yup ), (zlo , zup ) = limits
30323035
30333036 lolims_xyz = _mask_lists (xup , yup , zup , lolims & everymask )
0 commit comments