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

Appearance settings

Commit 7e1a65d

Browse filesBrowse files
committed
MNT: re-organize to simplify handling None as input
1 parent 80355e0 commit 7e1a65d
Copy full SHA for 7e1a65d

File tree

Expand file treeCollapse file tree

1 file changed

+15
-14
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+15
-14
lines changed

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+15-14Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,35 +2061,36 @@ def bar(self, *args, **kwargs):
20612061
label = kwargs.pop('label', '')
20622062
tick_labels = kwargs.pop('tick_label', None)
20632063

2064-
_x = x
2065-
_y = y
2064+
adjust_ylim = False
2065+
adjust_xlim = False
2066+
2067+
if orientation == 'vertical':
2068+
if y is None:
2069+
if self.get_yscale() == 'log':
2070+
adjust_ylim = True
2071+
y = 0
2072+
2073+
elif orientation == 'horizontal':
2074+
if x is None:
2075+
if self.get_xscale() == 'log':
2076+
adjust_xlim = True
2077+
x = 0
2078+
20662079
x, height, width, y, linewidth = np.broadcast_arrays(
20672080
# Make args iterable too.
20682081
np.atleast_1d(x), height, width, y, linewidth)
20692082

2070-
adjust_ylim = False
2071-
adjust_xlim = False
20722083
if orientation == 'vertical':
20732084
self._process_unit_info(xdata=x, ydata=height, kwargs=kwargs)
20742085
if log:
20752086
self.set_yscale('log', nonposy='clip')
2076-
# size width and y according to length of x
2077-
if _y is None:
2078-
if self.get_yscale() == 'log':
2079-
adjust_ylim = True
2080-
y = np.zeros_like(y)
20812087

20822088
tick_label_axis = self.xaxis
20832089
tick_label_position = x
20842090
elif orientation == 'horizontal':
20852091
self._process_unit_info(xdata=width, ydata=y, kwargs=kwargs)
20862092
if log:
20872093
self.set_xscale('log', nonposx='clip')
2088-
# size x and height according to length of y
2089-
if _x is None:
2090-
if self.get_xscale() == 'log':
2091-
adjust_xlim = True
2092-
x = np.zeros_like(x)
20932094

20942095
tick_label_axis = self.yaxis
20952096
tick_label_position = y

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.