How to use the mpld3.show 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 jayantj / w2vec-similarity / evaluate / evaluate.py View on Github external
cmap = get_cmap(num_clusters)
  for model_name in similarity_data['model_names']:
    model_name = os.path.splitext(os.path.basename(model_name))[0]
    cluster_label = similarity_data['doc2cluster'][model_name]
    point_colors.append(cmap(cluster_label))
    labels.append(re.compile(r"\s\([0-9]*\)-iter.*", re.IGNORECASE).split(model_name, 1)[0])
  embeddings = SpectralEmbedding(affinity='precomputed').fit_transform(np.array(similarity_data['similarity_matrix']))
  fig, ax = plt.subplots()
  x = embeddings[:, 0]
  y = embeddings[:, 1]
  annotes = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] * 10
  N = 100
  scatter = ax.scatter(x, y, c=point_colors[:],s=100*np.ones(shape=N))
  tooltip = mpld3.plugins.PointLabelTooltip(scatter, labels=labels)
  mpld3.plugins.connect(fig, tooltip)
  mpld3.show()
  # plt.scatter(tsne_embeddings[20:40, 0], tsne_embeddings[20:40, 1], c='b')
github apache / incubator-sdap-nexus / analysis / webservice / plotting.py View on Github external
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 cuemacro / finmarketpy / chartesians / graphs / lowleveladapters / adapterpythalesians.py View on Github external
except: pass

        try:
            plt.savefig(gp.file_output, transparent=False)
        except: pass


        ####### various matplotlib converters are unstable
        # convert to D3 format with mpld3
        try:
            # output matplotlib charts externally to D3 based libraries
            import mpld3

            if gp.display_mpld3 == True:
                mpld3.save_d3_html(fig, gp.html_file_output)
                mpld3.show(fig)
        except: pass

        # FRAGILE! convert to Bokeh format
        # better to use direct Bokeh renderer
        try:
            if (gp.convert_matplotlib_to_bokeh == True):
                from bokeh.plotting import output_file, show
                from bokeh import mpl

                output_file(gp.html_file_output)
                show(mpl.to_bokeh())
        except: pass

        # FRAGILE! convert matplotlib chart to Plotly format
        # recommend using AdapterCufflinks instead to directly plot to Plotly
        try:
github cuemacro / chartpy / chartpy / engine.py View on Github external
# writer = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1800)
                    # anim.save('test.mp4', writer=writer)

                plt.savefig(style.file_output, transparent=False)
        except Exception as e:
            print(str(e))

        ####### various matplotlib converters are unstable
        # convert to D3 format with mpld3
        try:
            # output matplotlib charts externally to D3 based libraries
            import mpld3

            if style.display_mpld3 == True:
                mpld3.save_d3_html(fig, style.html_file_output)
                mpld3.show(fig)
        except:
            pass

        # FRAGILE! convert to Bokeh format
        # better to use direct Bokeh renderer
        try:
            if (style.convert_matplotlib_to_bokeh == True):
                from bokeh.plotting import output_file, show
                from bokeh import mpl

                output_file(style.html_file_output)
                show(mpl.to_bokeh())
        except:
            pass

        # FRAGILE! convert matplotlib chart to Plotly format
github hugadams / scikit-spectra / skspec / plotting / mpld3wrapper.py View on Github external
#   points = ax.scatter(range(40), range(40))
   pman = PluginManager(fig=f)
   
   
   pman.add('mousepos')
   print pman._plugins
   pman.remove('boxzoom')
   pman.remove('zoom')
#   pman.add('linelabel')
   print pman._plugins
   
   

#   plugins.connect(fig, PointLabelTooltip(points[0]))
#   fig_to_html(fig)   
   mpld3.show(pman.fig)
github tim-fiola / network_traffic_modeler_py3 / examples / graph_network / graph_network_interactive.py View on Github external
def _run_plot():
    try:
        mpld3.show()
    except Exception as e:
        print("Encountered exception.")
        print(e)
        print()
        print("This may be due to an mpld3 bug described in the link below:")
        print("https://github.com/mpld3/mpld3/issues/434")
        print()
        print("To overcome this bug, run the following command from the CLI to")
        print("get the mpld3 patch from github:")
        print('python3 -m pip install --user "git+https://github.com/javadba/mpld3@display_fix"')
        print()
github apache / incubator-sdap-nexus / analysis / webservice / matserver.py View on Github external
X = np.zeros((20, 20, 4))

X[:, :, 0] = np.exp(- (x - 1) ** 2 - (y) ** 2)
X[:, :, 1] = np.exp(- (x + 0.71) ** 2 - (y - 0.71) ** 2)
X[:, :, 2] = np.exp(- (x + 0.71) ** 2 - (y + 0.71) ** 2)
X[:, :, 3] = np.exp(-0.25 * (x ** 2 + y ** 2))

im = ax.imshow(X, extent=(10, 20, 10, 20),
               origin='lower', zorder=1, interpolation='nearest')
fig.colorbar(im, ax=ax)

ax.set_title('An Image', size=20)

plugins.connect(fig, plugins.MousePosition(fontsize=14))

mpld3.show()