码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2015-09-12 17:44:02      阅读:778      评论:0      收藏:0      [点我收藏+]

标签:

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文件

标签:

原文地址:http://www.cnblogs.com/jiangz/p/4803252.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!