python - Pygal 子图(几张图)

标签 python matplotlib anaconda pygal continuum

我想在 python 2.7 上使用 Pygal 创建一个仪表板(在同一窗口中有几个图),但后者没有 subplot 功能,
有没有不使用 Bokeh 或情节的解决方案?

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>")  

关于python - Pygal 子图(几张图),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42653455/

相关文章:

python - NLP - 如何添加更多功能?

python - 为什么在 YOLOv5 中两个结果不同?

python - 未找到模块,未找到 ffmpeg

python - 如何在 sqlalchemy 过滤器中使用标记列?

python - django中api和REST api的区别

python - 增加 Matplotlib 文本中的字符间距?

python - Matplotlib imshow 偏移量以匹配轴?

python - Matplotlib:用数组调用绘图函数有什么作用?

python - 在anaconda spider中导入自己的.py文件

python - spyder:编辑继续在 python 中执行,而不是 IPython