Questions tagged [mpld3]

The mpld3 project brings together Matplotlib, the popular Python-based graphing library, and D3js, the popular Javascript library for creating interactive data visualizations for the web.

The mpld3 project brings together Matplotlib, the popular Python-based graphing library, and D3js, the popular Javascript library for creating interactive data visualizations for the web. The result is a simple API for exporting your matplotlib graphics to HTML code which can be used within the browser, within standard web pages, blogs, or tools such as the IPython notebook.

154 questions
10
votes
2 answers

Json serialization error using matplotlib mpld3 with LinkedBrush

The mpld3 (matplotlib on d3) example for LinkedBrush http://mpld3.github.io/examples/linked_brush.html provides the following code example: import numpy as np import matplotlib import matplotlib.pyplot as plt from sklearn.datasets import…
WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560
8
votes
3 answers

Is it actually possible to pass data (callback) from mpld3 to ipython?

There is a lot of amazing possibilities to create animated pictures using mpld3. However, it seems that all the "moving parts" are responsibility of JavaScript. Moreover, there are lots of requests on the internet and Stack Overflow where people…
Sergey Dovgal
  • 614
  • 6
  • 21
7
votes
0 answers

mpld3 results in TypeError: Object of type 'ndarray' is not JSON serializable

If I run import pandas as pd import mpld3 import seaborn as sns df = pd.DataFrame([(1,3),(2,-1)],columns= ['a','b']) plt.figure(figsize=(5,5)) sns.regplot('a', 'b', df) works fine. If I add mpld3.enable_notebook() I…
Carlo
  • 395
  • 1
  • 8
  • 22
7
votes
1 answer

Saving interactive series on matplotlib figures (html)

I have an example (from matplotlib) for an interactive plot where I can select from the series which lines I want to display on the plot. This works perfectly but now I want to export this to an html. I can successfully do this with…
Michael Berry
  • 923
  • 3
  • 13
  • 17
7
votes
1 answer

How to place a matplotlib plot into an html container using mpld3 and flask

I am trying to use the mpld3-flask example (https://github.com/nipunreddevil/mpld3-flask) as a template to achieve a certain behavior. What I would like, is to add links on the header bar to different plots, rather than having a radio button query…
Brian Hayden
  • 359
  • 2
  • 10
6
votes
2 answers

Python: How to get data from linked brushes in mlpd3, Bokeh, Plotly?

Using the code below I can get a 2x2 graph with 4 plots. With brushes, I can select some data points. The question I have is how do get the selected data points as a JSON array or cvs. This code uses mlpd3, but bokeh can do similar selections with…
Merlin
  • 24,552
  • 41
  • 131
  • 206
6
votes
3 answers

mpld3 3D scatter plot

I am exploring the mpld3 library and can't figure out how to create 3D scatter plots. With Matplotlib I would do: import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D fig = plt.figure() ax = fig.add_subplot(111,…
Botond
  • 2,640
  • 6
  • 28
  • 44
6
votes
2 answers

Convert categorical variable to color with Matplotlib

I have a list of 150 variables that have the following possible values: domain = ['val1', 'val2', 'val2'] I want to convert these to be used as color for a matplot scatter plot. Currently I wrote a function to manually map from my data domain…
user2726995
  • 2,064
  • 2
  • 21
  • 26
5
votes
2 answers

mpld3 does not display dates on x axis correctly

I am plotting a large dataset from a database using matplotlib and I use mpld3 to pass the figure to the browser. On the x-axis there are dates. The issue here is that while plotting without the mpld3 works perfect, when I use it, the dates don't…
tzoukritzou
  • 337
  • 1
  • 4
  • 16
5
votes
1 answer

Get point information after dragging

There is the amazing mpld3 for interactive matplotlib-plots in IPython Notebooks. mpld3 also features plugins. One is especially interesting for me: You can pick a point in the plot and drag it around - it is presented…
Anna Christine
  • 860
  • 1
  • 6
  • 14
4
votes
1 answer

mpld3 is not showing graph in Colab

I'm working in google colab and using mpld3 to plot graphs. Everything was working fine till last time but now colab is not showing graphs when I use mpld3. I get a graph when I simply use pyplot and don't use mpld3. Any idea what might be the…
4
votes
0 answers

Object of type 'ndarray' is not JSON serializable in mpld3

I want to get the interaсtive Matplotlib window in IPython notebook. I have several 2D points and I want to draw this. So I do import matplotlib.pyplot as plt, mpld3 plt.scatter(points[0], points[1], color='r') mpld3.show() But I get error Object…
Multifora
  • 133
  • 1
  • 10
4
votes
2 answers

Setting tick labels in mpld3

I'm trying to create a simple bar graph with some data (hard coded here, but I'll be reading it in from a file at some point). So far, I'm able to get the bar graph, but I would like the attribute "Feature Name" to come under each bar. Right now,…
lordingtar
  • 1,042
  • 2
  • 12
  • 29
4
votes
1 answer

mpld3 generated html missing xticklabels and color in the legend

I am simply using the matplotlib example here and writing it out as html using mpld3. However the generated html using mpld3 is missing the xticklabels and color in the legend. If I generate the plot without converting to html it is generated just…
Ankur Agarwal
  • 23,692
  • 41
  • 137
  • 208
4
votes
2 answers

How do I easily generate a report from python including matplotlib figures and pandas tables

I have a code which calculates a performance report (including text, pandas tables and matplotlib figures). I am looking for away to export this report to a file (html/pdf etc). I have tried using pweave but I couldn't make it work properly (the…
Hanan Shteingart
  • 8,480
  • 10
  • 53
  • 66
1
2 3
10 11