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

Skip to content

Commit 9c031b9

Browse files
authored
Merge pull request #8025 from tacaswell/fix_log_subs
FIX: numpy arrays are not 'truthy'
2 parents 493cb8a + 3ae2ec9 commit 9c031b9

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)