How to use the mpld3.plugins.PointLabelTooltip 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 apache / incubator-sdap-nexus / analysis / webservice / algorithms_spark / HofMoellerSpark.py View on Github external
else:
                return ""

        ax.xaxis.set_major_formatter(FuncFormatter(xFormatter))
        ax.yaxis.set_major_formatter(FuncFormatter(yFormatter))

        ax.set_title(title)
        ax.set_ylabel(coordName)
        ax.set_xlabel('Date')

        fig.colorbar(cax)
        fig.autofmt_xdate()

        labels = ['point {0}'.format(i + 1) for i in range(len(data))]
        # plugins.connect(fig, plugins.MousePosition(fontsize=14))
        tooltip = mpld3.plugins.PointLabelTooltip(cax, labels=labels)

        sio = StringIO()
        plt.savefig(sio, format='png')
        return sio.getvalue()
github jcornford / pyecog / pyecog / visualisation / data_explorer.py View on Github external
#points = radviz2(df,'Network States',dataobj, ax = ax, color = cmap, edgecolor = 'white')
ax2.set_xlabel('Feature 2')
ax2.set_ylabel('Feature 1')

# create the line object
lines = ax1.plot(x, 0 * x, '-w', lw=1, alpha=0.8)
ax1.set_ylim(-1, 1)

ax1.set_title("Hover over points to see lines")

# transpose line data and add plugin
linedata = data.transpose(0, 2, 1).tolist()


labels = ["Trace {0}".format(i) for i in range(301)]
tooltip = plugins.PointLabelTooltip(points, labels)

plugins.connect(fig,LinkedView(points, lines[0], linedata))
plugins.connect(fig, ClickInfo(points))
#plugins.connect(fig,tooltip)
mpld3.display()
github jeffhsu3 / genda / genda / AEI / AEI_plot.py View on Github external
# Need to make the text relative positioning
                    #labels = list(self.annot_table.index)
                    #tooltip = mpld3.plugins.PointLabelTooltip(scatter, labels=labels)
                    ko += 1
                    io += 1
                else: 
                    pass
            scatter = ax[-1, j].scatter(pos,
                    -1*np.log10(self.meQTL.ix[: , 'p-value']),
                                     c=self.ld,
                                     s=size_maf, cmap=cm)
            ax[-1, j].set_ylabel('-1*$log_{10}$ p-value', fontsize=15)
            ax[-1, j].set_xlabel('Genomic Position (mb)', fontsize=15)
            ax[-1, j].set_title('%s eQTL plot' % (self.gene_name,), fontsize=25)
            labels = list(self.annot_table.index)
            tooltip = mpld3.plugins.PointLabelTooltip(scatter, labels=labels)
            mpld3.plugins.connect(fig, tooltip,  plugins.LinkedBrush(scatter))
        fig.tight_layout()
        return(fig)
github apache / incubator-sdap-nexus / analysis / webservice / algorithms / HofMoeller.py View on Github external
else:
                return ""

        ax.xaxis.set_major_formatter(FuncFormatter(xFormatter))
        ax.yaxis.set_major_formatter(FuncFormatter(yFormatter))

        ax.set_title(title)
        ax.set_ylabel(coordName)
        ax.set_xlabel('Date')

        fig.colorbar(cax)
        fig.autofmt_xdate()

        labels = ['point {0}'.format(i + 1) for i in range(len(data))]
        # plugins.connect(fig, plugins.MousePosition(fontsize=14))
        tooltip = mpld3.plugins.PointLabelTooltip(cax, labels=labels)

        sio = StringIO()
        plt.savefig(sio, format='png')
        return sio.getvalue()
github apache / incubator-sdap-nexus / analysis / webservice / plotting.py View on Github external
else:
            return ""

    ax.xaxis.set_major_formatter(FuncFormatter(xFormatter))
    ax.yaxis.set_major_formatter(FuncFormatter(yFormatter))

    ax.set_title(title)
    ax.set_ylabel(coordName)
    ax.set_xlabel('Date')

    fig.colorbar(cax)
    fig.autofmt_xdate()

    labels = ['point {0}'.format(i + 1) for i in range(len(data))]
    # plugins.connect(fig, plugins.MousePosition(fontsize=14))
    tooltip = mpld3.plugins.PointLabelTooltip(cax, labels=labels)
    mpld3.plugins.connect(fig, tooltip)
    mpld3.show()
    # sio = StringIO()
github interrogator / corpkit / corpkit / plotter.py View on Github external
for i, l in enumerate(lines):
            y_vals = l.get_ydata()
            x_vals = l.get_xdata()
            x_vals = [str(x) for x in x_vals]
            if absolutes:
                ls = ['%s (%s: %d)' % (labels[i], x_val, y_val) for x_val, y_val in zip(x_vals, y_vals)]
            else:
                ls = ['%s (%s: %.2f%%)' % (labels[i], x_val, y_val) for x_val, y_val in zip(x_vals, y_vals)]
            if 2 in interactive_types:
                #if 'kind' in kwargs and kwargs['kind'] == 'area':
                tooltip_line = mpld3.plugins.LineLabelTooltip(lines[i], labels[i])
                mpld3.plugins.connect(plt.gcf(), tooltip_line)
                #else:
                if kind == 'line':
                    tooltip_point = mpld3.plugins.PointLabelTooltip(l, labels = ls)
                    mpld3.plugins.connect(plt.gcf(), tooltip_point)
        
    if piemode:
        if not sbplt:
            plt.axis('equal')
            ax.get_xaxis().set_visible(False)
            ax.get_yaxis().set_visible(False)

    # add x label
    # this could be revised now!
    # if time series period, it's year for now
    if isinstance(dataframe.index, pandas.tseries.period.PeriodIndex):
        x_label = 'Year'

    y_l = False
    if not absolutes: