Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 290219e

Browse files
committed
Fixed tick locations w/ units
1 parent a1a4fd6 commit 290219e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2194,16 +2194,10 @@ def bar(self, *args, **kwargs):
21942194
self._process_unit_info(xdata=x, ydata=height, kwargs=kwargs)
21952195
if log:
21962196
self.set_yscale('log', nonposy='clip')
2197-
2198-
tick_label_axis = self.xaxis
2199-
tick_label_position = x
22002197
elif orientation == 'horizontal':
22012198
self._process_unit_info(xdata=width, ydata=y, kwargs=kwargs)
22022199
if log:
22032200
self.set_xscale('log', nonposx='clip')
2204-
2205-
tick_label_axis = self.yaxis
2206-
tick_label_position = y
22072201
else:
22082202
raise ValueError('invalid orientation: %s' % orientation)
22092203

@@ -2225,6 +2219,14 @@ def bar(self, *args, **kwargs):
22252219
# Make args iterable too.
22262220
np.atleast_1d(x), height, width, y, linewidth)
22272221

2222+
# Now that units have been converted, set the tick locations.
2223+
if orientation == 'vertical':
2224+
tick_label_axis = self.xaxis
2225+
tick_label_position = x
2226+
elif orientation == 'horizontal':
2227+
tick_label_axis = self.yaxis
2228+
tick_label_position = y
2229+
22282230
linewidth = itertools.cycle(np.atleast_1d(linewidth))
22292231
color = itertools.chain(itertools.cycle(mcolors.to_rgba_array(color)),
22302232
# Fallback if color == "none".

0 commit comments

Comments
 (0)