def _test_remove_from_figure(use_gridspec):
 fig = plt.figure()
 ax = fig.add_subplot(111)
 sc = ax.scatter([1, 2], [3, 4], cmap=u'spring')
 sc.set_array(np.array([5, 6]))
 pre_figbox = np.array(ax.figbox)
 cb = fig.colorbar(sc, use_gridspec=use_gridspec)
 fig.subplots_adjust()
 cb.remove()
 fig.subplots_adjust()
 post_figbox = np.array(ax.figbox)
 assert (pre_figbox == post_figbox).all()

def _test_remove_from_figure ( use_gridspec ) : fig = plt . figure ( ) ax = fig . add_subplot ( 111 ) sc = ax . scatter ( [ 1 , 2 ] , [ 3 , 4 ] , cmap = u'spring' ) sc . set_array ( np . array ( [ 5 , 6 ] ) ) pre_figbox = np . array ( ax . figbox ) cb = fig . colorbar ( sc , use_gridspec = use_gridspec ) fig . subplots_adjust ( ) cb . remove ( ) fig . subplots_adjust ( ) post_figbox = np . array ( ax . figbox ) assert ( pre_figbox == post_figbox ) . all ( )
test remove_from_figure with the specified use_gridspec setting .