Skip to content

Commit 3ae2ec9

Browse files
committed
FIX: numpy arrays are not 'truthy'
Check if not None, not the truth value of `self.subs` when setting up log scales. closes #8023
1 parent fbe562c commit 3ae2ec9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/matplotlib/scale.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def set_default_locators_and_formatters(self, axis):
251251
axis.set_minor_locator(LogLocator(self.base, self.subs))
252252
axis.set_minor_formatter(
253253
LogFormatterSciNotation(self.base,
254-
labelOnlyBase=bool(self.subs)))
254+
labelOnlyBase=(self.subs is not None)))
255255

256256
def get_transform(self):
257257
"""

lib/matplotlib/tests/test_scale.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ def test_log_scatter():
4848
fig.savefig(buf, format='svg')
4949

5050

51+
@cleanup
52+
def test_logscale_subs():
53+
fig, ax = plt.subplots()
54+
ax.set_yscale('log', subsy=np.array([2, 3, 4]))
55+
# force draw
56+
fig.canvas.draw()
57+
58+
5159
if __name__ == '__main__':
5260
import nose
5361
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

0 commit comments

Comments
 (0)