def create_patch_viewer(grid_shape, vis_chains, m):
 pv = PatchViewer(grid_shape, vis_chains.shape[1:3], is_color=(vis_chains.shape[(-1)] == 3))
 for i in xrange(m):
  pv.add_patch(vis_chains[i, :], rescale=False)
 return pv

def create_patch_viewer ( grid_shape , vis_chains , m ) : pv = PatchViewer ( grid_shape , vis_chains . shape [ 1 : 3 ] , is_color = ( vis_chains . shape [ ( - 1 ) ] == 3 ) ) for i in xrange ( m ) : pv . add_patch ( vis_chains [ i , : ] , rescale = False ) return pv
add the patches to show .