问题描述
ig.plot( test,bBox=(800,800),margin = 20,vertex_color = [color_dict1[vl] for vl in test.vs["cluster_id"]],edge_curved=True,edge_color= 'silver',vertex_size= 6,layout='fr',target=ax)
而且,我使用以下代码制作了顶级集群 ID 的图例图:
fig = plt.figure(figsize=(1,1))
plt.axis('off')
plt.rcParams["font.family"] = "serif"
for cl,col,perc in list(list_cl_perc1[:20]):
plt.scatter([],[],c=col,label='Cluster {} ({}%)'.format(int(cl),perc),s=300,figure=fig)
#legend_x = 1
#legend_y = 1 #bBox_to_anchor=(legend_x,legend_y)
plt.legend(title= 'Top 20 Clusters',loc='best',prop={'size': 17},ncol=1,title_fontsize=17,frameon=False,framealpha=1)
plt.savefig('legend.png',bBox_inches='tight',dpi=100)
plt.show()
在我使用以下方法连接这两个结果后:
import sys
from PIL import Image
images = [Image.open(x) for x in ['plots.png','legend.png']]
widths,heights = zip(*(i.size for i in images))
total_width = sum(widths)
max_height = max(heights)
new_im = Image.new('RGB',(total_width,max_height))
x_offset = 0
for im in images:
new_im.paste(im,(x_offset,0))
x_offset += im.size[0]
new_im.save('test.jpg')
'concat' 后的结果: final
我想知道是否有关于“如何在不导出的情况下连接这些图”的解决方案
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)