本文介绍了Pygal子图(几个数字)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在python 2.7上使用Pygal创建一个仪表板(同一窗口中有多个图),但后者没有subplot功能,有没有使用bokeh或密谋的解决方案?
I want to create a dashboard using Pygal on python 2.7 (Several plots in the same window) but the later doesn't have the subplot function,Is there a solution, without using bokeh or plotly?
Matplotlib上的示例:
fig, axes = plt.subplots(ncols=4, nrows=5, figsize=(35,20))
for ax in axes.flatten():
ax.plot([2,3,5,1])
plt.show()
Pygal上是否有类似的东西?
推荐答案
# -*- coding: utf-8 -*-
import pygal
list2=["A","B","C","D"]
liste_A=[10,20,30,40]
liste_B=[100,10,50,20]
html_file=open("merged.html",'w')
html_file.write("<html><head>…</head><body>"+"\n")
success_plot =pygal.Line(height=400,include_x_axis=True,label_font_size=4,title_font_size=26,x_title='semaines',y_title='taux_debit',legend_at_bottom=True,x_label_rotation=90)
success_plot.title = ('Title1')
success_plot.x_labels = list2
success_plot.add('PLOT 1', liste_A)
success_plot.add('PLOT 2', liste_B)
success_plot.render_to_file('graph1.svg')
html_file.write(" <object type=\"image/svg+xml\" data=\"graph1.svg\"></object>"+"\n")
success_plot.title = ('Title2')
success_plot.x_labels = list2
success_plot.add('PLOT 2', liste_A)
success_plot.add('PLOT 3', liste_B)
success_plot.render_to_file('graph2.svg')
html_file.write(" <object type=\"image/svg+xml\" data=\"graph2.svg\"></object>"+"\n")
html_file.write("</body></html>")
这篇关于Pygal子图(几个数字)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!