import matplotlibmatplotlib.use(‘Agg‘)import matplotlib.pyplot as pltfrom 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
时间: 2024-10-06 07:55:56