@@ -392,8 +392,7 @@ def layout_from_subplotspec(self, subspec,
392392 parent = self .parent
393393
394394 # OK, now, we want to set the position of this subplotspec
395- # based on its subplotspec parameters. The new gridspec will inherit.
396-
395+ # based on its subplotspec parameters. The new gridspec will inherit
397396 # from gridspec. prob should be new method in gridspec
398397 left = 0.0
399398 right = 1.0
@@ -406,32 +405,31 @@ def layout_from_subplotspec(self, subspec,
406405
407406 # calculate accumulated heights of columns
408407 cellH = totHeight / (nrows + hspace * (nrows - 1 ))
409- sepH = hspace * cellH
408+ sepH = hspace * cellH
410409
411410 if gs ._row_height_ratios is not None :
412411 netHeight = cellH * nrows
413- tr = float ( sum (gs ._row_height_ratios ) )
414- cellHeights = [netHeight * r / tr for r in gs ._row_height_ratios ]
412+ tr = sum (gs ._row_height_ratios )
413+ cellHeights = [netHeight * r / tr for r in gs ._row_height_ratios ]
415414 else :
416415 cellHeights = [cellH ] * nrows
417416
418417 sepHeights = [0 ] + ([sepH ] * (nrows - 1 ))
419- cellHs = np .add .accumulate (np .ravel (
420- list (zip (sepHeights , cellHeights ))))
418+ cellHs = np .cumsum (np .column_stack ([sepHeights , cellHeights ]).flat )
421419
422420 # calculate accumulated widths of rows
423- cellW = totWidth / (ncols + wspace * (ncols - 1 ))
424- sepW = wspace * cellW
421+ cellW = totWidth / (ncols + wspace * (ncols - 1 ))
422+ sepW = wspace * cellW
425423
426424 if gs ._col_width_ratios is not None :
427425 netWidth = cellW * ncols
428- tr = float ( sum (gs ._col_width_ratios ) )
426+ tr = sum (gs ._col_width_ratios )
429427 cellWidths = [netWidth * r / tr for r in gs ._col_width_ratios ]
430428 else :
431429 cellWidths = [cellW ] * ncols
432430
433431 sepWidths = [0 ] + ([sepW ] * (ncols - 1 ))
434- cellWs = np .add . accumulate (np .ravel ( list ( zip ( sepWidths , cellWidths ))) )
432+ cellWs = np .cumsum (np .column_stack ([ sepWidths , cellWidths ]). flat )
435433
436434 figTops = [top - cellHs [2 * rowNum ] for rowNum in range (nrows )]
437435 figBottoms = [top - cellHs [2 * rowNum + 1 ] for rowNum in range (nrows )]
0 commit comments