alireza shokrizade
alireza shokrizade

Reputation: 191

How to show matplotlib charts in browser (html)?

I need to open a bar charts in Matplotlib in a browser-Like Firefox- but I shouldn't use Bokeh in my Project. Any suggestions?

Upvotes: 2

Views: 7594

Answers (2)

willo
willo

Reputation: 979

IPython with %matplotlib inline as demonstrated here

Upvotes: 1

sebix
sebix

Reputation: 3239

Use the WebAgg backend, which opens a browser window with the plot and is fully interactive like the Qt or GTK window.

import matplotlib as mpl
mpl.use('WebAgg')
import matplotlib.pyplot as plt
# do your plotting
plt.show()

For example:

>>> import numpy as np
>>> a=np.random.random(100)
>>> b=np.random.random(100)
>>> plt.plot(a,b)

Opens http://127.0.0.1:8988/ showing: enter image description here

Upvotes: 5

Related Questions