#NEWLINE# def _compute_borders( self ) : #NEWLINE# #INDENT# ndims = self . layout . ndims #NEWLINE# ( xkey , ykey ) = ( self . _xkeys [ 0 ] , self . _ykeys [ 0 ] ) #NEWLINE# width_fn = ( lambda x : x . range ( 0 ) ) #NEWLINE# height_fn = ( lambda x : x . range ( 1 ) ) #NEWLINE# if ( ndims > 1 ) : #NEWLINE# #INDENT# vert_section = hm . layout [ ( xkey , slice ( None ) ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# vert_section = [ self . layout [ xkey ] ] #NEWLINE# #UNINDENT# horz_section = self . layout [ ( ( slice ( None ) , ykey ) if ( ndims > 1 ) else slice ( None ) ) ] #NEWLINE# height_extents = [ max_range ( hm . traverse ( height_fn , [ Element ] ) ) for hm in vert_section ] #NEWLINE# width_extents = [ max_range ( hm . traverse ( width_fn , [ Element ] ) ) for hm in horz_section ] #NEWLINE# widths = [ ( extent [ 0 ] - extent [ 1 ] ) for extent in width_extents ] #NEWLINE# heights = [ ( extent [ 0 ] - extent [ 1 ] ) for extent in height_extents ] #NEWLINE# ( width , height ) = ( np . sum ( widths ) , np . sum ( heights ) ) #NEWLINE# border_width = ( ( width * self . padding ) / ( len ( widths ) + 1 ) ) #NEWLINE# border_height = ( ( height * self . padding ) / ( len ( heights ) + 1 ) ) #NEWLINE# width += ( width * self . padding ) #NEWLINE# height += ( height * self . padding ) #NEWLINE# return ( width , height , border_width , border_height , widths , heights )