javascript - Plotting a bar chart from data in a python dictionary -


i have dictionary in python script contains data want create bar chart with.

i used matplotlib , able generate bar chart image , save it. not enough because want send bar chart out email , cannot embed bar chart image in email's html body. know can use <img> tag issue email body populated in jenkins part of pre-send script , externally generated images cannot sent out way.

i thinking of using d3.js generate visualizations dictionary data. need , how start , glue python , js together.

fyi, using html package in python generate html using python code. allows me generate html tables html has not tags bar chart etc hence issue.

as minimal example html format bar chart generated python matplotlib , mpld3, have,

import matplotlib.pyplot plt import numpy np import mpld3  fig, ax = plt.subplots(1,1) n = 10 bar = ax.bar(range(n),np.random.normal(size=n)) mpld3.save_html(fig,'./out.html') 

and use out.html or call mpld3.fig_to_html(fig) generate code or mpld3.fig_to_dict output json-serializable dictionary representation of figure.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -