2017-03-07 11 views
1

python 2.7 (동일한 창에서 여러 개의 그림)에서 Pygal을 사용하여 대시 보드를 만들고 싶지만 나중에 subplot 함수가 없습니다. bokeh 나 plly를 사용하지 않고도 해결책이 있습니까? ? 하기 matplotlib에Pygal subplot (여러 그림)

예 :

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에 이런 일이 있습니까?

+1

참조 [A, 최소 완료하고 검증 가능한 예제를 만드는 방법] (http://stackoverflow.com/help/mcve) – Lucas

+1

난 그냥 업데이트 내 질문 –

답변

0
# -*- 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>")