python画柱状图并且输出到html文件

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from Cstring import StringIO
y = [3, 10, 7, 5, 3, 4.5, 6, 8.1]
N = len(y)
x = range(N)
width = 1/1.5
plt.bar(x, y, width, color="blue")
io=StringIO()
plt.savefie(io,format="png")
plt.xticks(rotation=70)
image_tag='<img src="data:image/png;base64,%s"/>'% io.getvalue().encode("base64").strip()


 
 

 PythonWise: Serving Dynamic Images with matplotlib

dynamically-serving-a-matplotlib-image-to-the-web-using-python%s

Matplotlib 画柱状图 - wishchin的专栏 - 博客频道 - CSDN.NET

matplotlib Bar Charts | Examples | Plotly

python - Date ticks and rotation in matplotlib - Stack Overflow

python - Generating a PNG with matplotlib when DISPLAY is undefined - Stack Overflow

你可能感兴趣的:(python画柱状图并且输出到html文件)