Skip to content

Commit 40bbe61

Browse files
committed
Merge remote-tracking branch 'matplotlib/v1.5.x' into v2.x
2 parents 8e57552 + cab8cf7 commit 40bbe61

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

lib/matplotlib/mlab.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -3188,9 +3188,8 @@ def get_justify(colname, column, precision):
31883188
ntype = column.dtype
31893189

31903190
if np.issubdtype(ntype, str) or np.issubdtype(ntype, bytes):
3191-
# The division below handles unicode stored in array, which could
3192-
# have 4 bytes per char
3193-
length = max(len(colname), column.itemsize // column[0].itemsize)
3191+
fixed_width = int(ntype.str[2:])
3192+
length = max(len(colname), fixed_width)
31943193
return 0, length+padding, "%s" # left justify
31953194

31963195
if np.issubdtype(ntype, np.int):

lib/matplotlib/tests/test_mlab.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -403,10 +403,10 @@ def test_csv2txt_basic(self):
403403
(str('y'), np.int8),
404404
(str('s'), str, 3),
405405
(str('s2'), str, 4)]))
406-
truth = (' x y s s2\n'
407-
' 1.000 2 foo bing \n'
408-
' 2.000 3 bar blah ')
409-
assert_equal(mlab.rec2txt(a), truth)
406+
truth = (' x y s s2\n'
407+
' 1.000 2 foo bing \n'
408+
' 2.000 3 bar blah ').splitlines()
409+
assert_equal(mlab.rec2txt(a).splitlines(), truth)
410410

411411

412412
class window_testcase(CleanupTestCase):

0 commit comments

Comments
 (0)