Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3883fa0

Browse files
committed
Use atleast_1d instead of redefining it.
1 parentd17d6b5 commit3883fa0

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

‎lib/matplotlib/axes/_axes.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,20 +1997,14 @@ def bar(self, left, height, width=0.8, bottom=None, **kwargs):
19971997
label=kwargs.pop('label','')
19981998
tick_labels=kwargs.pop('tick_label',None)
19991999

2000-
defmake_iterable(x):
2001-
ifnotiterable(x):
2002-
return [x]
2003-
else:
2004-
returnx
2005-
20062000
# make them safe to take len() of
20072001
_left=left
2008-
left=make_iterable(left)
2009-
height=make_iterable(height)
2010-
width=make_iterable(width)
2002+
left=np.atleast_1d(left)
2003+
height=np.atleast_1d(height)
2004+
width=np.atleast_1d(width)
20112005
_bottom=bottom
2012-
bottom=make_iterable(bottom)
2013-
linewidth=make_iterable(linewidth)
2006+
bottom=np.atleast_1d(bottom)
2007+
linewidth=np.atleast_1d(linewidth)
20142008

20152009
adjust_ylim=False
20162010
adjust_xlim=False
@@ -2186,9 +2180,7 @@ def make_iterable(x):
21862180
self.add_container(bar_container)
21872181

21882182
iftick_labelsisnotNone:
2189-
tick_labels=make_iterable(tick_labels)
2190-
ifisinstance(tick_labels,six.string_types):
2191-
tick_labels= [tick_labels]
2183+
tick_labels=np.atleast_1d(tick_labels)
21922184
iflen(tick_labels)==1:
21932185
tick_labels*=nbars
21942186
iflen(tick_labels)!=nbars:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp