コード例 #1
0
ファイル: figure.py プロジェクト: cuijianaaa/tf-matplotlib
        def pyfnc_callee(*tensor_values, **unused):

            try:
                nonlocal figs, bgs
                pos_args = tf_args.mix_args(tensor_values)

                if figs is None:
                    figs, artists = init_func(*pos_args, **func_kwargs)
                    figs = as_list(figs)
                    artists = as_list(artists)
                    for f in figs:
                        f.canvas.draw()
                    for a in artists:
                        a.set_animated(True)
                    bgs = [f.canvas.copy_from_bbox(f.bbox) for f in figs]

                artists = as_list(func(*pos_args, **func_kwargs))

                for f, bg in zip(figs, bgs):
                    f.canvas.restore_region(bg)
                for a in artists:
                    a.axes.draw_artist(a)
                for f in figs:
                    f.canvas.blit(f.bbox)

                return figure_buffer(figs)
            except Exception:
                print('-' * 5 + 'tfmpl catched exception' + '-' * 5)
                print(traceback.format_exc())
                print('-' * 20)
                raise
コード例 #2
0
ファイル: figure.py プロジェクト: nmatare/tf-matplotlib
 def pyfnc_callee(*tensor_values, **unused):
     try:
         figs = as_list(func(*tf_args.mix_args(tensor_values), **func_kwargs))
         for f in figs:
             f.canvas.draw()
         return figure_buffer(figs)
     except Exception:
         print('-'*5 + 'tfmpl catched exception' + '-'*5)
         print(traceback.format_exc())                
         print('-'*20)
         raise