How to use the mpld3.plugins.Zoom function in mpld3

To help you get started, we’ve selected a few mpld3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ratschlab / spladder / matlab / spladder_viz.py View on Github external
event_info = [x[::-1] for x in re.split(r'[._]', options.event_id[::-1], maxsplit=1)[::-1]]
            event_info[1] = int(event_info[1]) - 1
            event_info = sp.array(event_info, dtype='str')[sp.newaxis, :]
            event_tag = '.%s' % options.event_id
        ### get all significant events of the current gene
        else:
            event_info = get_conf_events(options, gid)
            
        plot_event(options, event_info, axes[-1], xlim)

        plt.tight_layout()
        ### save plot into file
        if options.format == 'd3':
            out_fname = os.path.join(options.outdir, 'plots', 'gene_overview_%s%s%s.html' % (gene.name, event_tag, log_tag))
            plugins.clear(fig)
            plugins.connect(fig, plugins.Zoom(enabled=True), ClickInfo(sp.ones((10000,), dtype='int')))
            mpld3.save_html(fig, open(out_fname, 'w'))
        else:
            out_fname = os.path.join(options.outdir, 'plots', 'gene_overview_%s%s%s.%s' % (gene.name, event_tag, log_tag, options.format))
            plt.savefig(out_fname, format=options.format, bbox_inches='tight')
        plt.close(fig)