How to plot animated matplotlib in html with mpld3

637 Views Asked by At

I want to show a graphs that is monitoring a sensor data in my raspberry pi in a html page. I have been using matplotlib graphs and recently I have installed mpld3 library but I the code shows me this error:

Fontconfig warning: "/etc/fonts/fonts.conf", line 100: unknown element "blank"
[2786:2888:0217/042317.744817:ERROR:object_proxy.cc(621)] Failed to call method: org.freedesktop.Notifications.GetCapabilities: object_path= /org/freedesktop/Notifications: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Notifications was not provided by any .service files
ATTENTION: default value of option force_s3tc_enable overridden by environment.
127.0.0.1 - - [17/Feb/2022 04:23:19] "GET / HTTP/1.1" 200 -
[2838:2838:0217/042319.282873:ERROR:sandbox_linux.cc(364)] InitializeSandbox() called with multiple threads in process gpu-process.
[1:8:0217/042319.671753:ERROR:command_buffer_proxy_impl.cc(124)] ContextResult::kTransientFailure: Failed to send GpuChannelMsg_CreateCommandBuffer.
127.0.0.1 - - [17/Feb/2022 04:23:20] "GET /d3.js HTTP/1.1" 200 -
127.0.0.1 - - [17/Feb/2022 04:23:20] "GET /mpld3.js HTTP/1.1" 200 -
127.0.0.1 - - [17/Feb/2022 04:23:21] code 404, message Not Found
127.0.0.1 - - [17/Feb/2022 04:23:21] "GET /favicon.ico HTTP/1.1" 404 -

And the code that I'm running is this:

from matplotlib.pyplot import figure
import mpld3

fig = figure()
ax = fig.gca()
ax.plot([1,2,3,4])

mpld3.show(fig)

What is my error? Or if you know how to show matplots graphs in html only with python and html!

thanks!

1

There are 1 best solutions below

0
On

Consider using mpld3.enable_notebook(). The documentation says "This is useful if you want every figure to be automatically embedded in the notebook as an interactive JavaScript figure." You can find other resources here.

1 - In regards to your Chromium error, see this.

2 - In regards to your Sandbox error, see this.

3 - In regards to your GPU error, see this.