How to use the mpld3.plugins.BoxZoom 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 dparks1134 / RefineM / refinem / plots / tetra_pca_plot.py View on Github external
Parameters
        ----------
        genome_scaffold_stats : d[scaffold_id] -> namedtuple of scaffold stats
          Statistics for scaffolds in genome.
        highlight_scaffold_ids : d[scaffold_id] -> color
            Scaffolds in genome to highlight.
        link_scaffold_ids : list of scaffold pairs
            Pairs of scaffolds to link together.
        """

        # Set size of figure
        self.fig.clear()

        mpld3.plugins.clear(self.fig)
        mpld3.plugins.connect(self.fig, mpld3.plugins.Reset(), mpld3.plugins.BoxZoom(), mpld3.plugins.Zoom())
        mpld3.plugins.connect(self.fig, mpld3.plugins.MousePosition(fontsize=12, fmt='.1f'))

        self.fig.set_size_inches(self.options.width, self.options.height)

        axis_pc1_pc2 = self.fig.add_subplot(221)
        axis_pc3_pc2 = self.fig.add_subplot(222)
        axis_pc1_pc3 = self.fig.add_subplot(223)
        axis_variance = self.fig.add_subplot(224)

        scatter, _, _, _ = self.plot_on_axes(self.fig, 0, 1,
                                              genome_scaffold_stats,
                                              highlight_scaffold_ids,
                                              link_scaffold_ids,
                                              axis_pc1_pc2, True)

        self.plot_on_axes(self.fig, 2, 1,
github hugadams / scikit-spectra / skspec / plotting / mpld3wrapper.py View on Github external
""" Wrappers and utilitiles for MPLD3 customization """

import mpld3
from mpld3.plugins import Reset, Zoom, BoxZoom, \
           PointLabelTooltip, PointHTMLTooltip, LineLabelTooltip, \
           MousePosition, LineHTMLTooltip

ALLPLUGINS = dict(
   reset=Reset,
   zoom=Zoom,
   boxzoom=BoxZoom, 
   pointlabel=PointLabelTooltip,
   pointHTMLlabel = PointHTMLTooltip, 
   linelabel=LineLabelTooltip, 
   linehtml=LineHTMLTooltip,
   mousepos=MousePosition
   )

# Reversed dictionary
ALLPLUGINS_REV = dict((v, k) for k,v in ALLPLUGINS.items())

# Plugins that require access to lines
LABELPLUGINS = [LineLabelTooltip, PointLabelTooltip]
HTMLPLUGINS = [LineHTMLTooltip, PointHTMLTooltip]

DEFAULTS = ('reset','boxzoom','zoom')