韦恩图

import matplotlib.pyplot as plt
from matplotlib_venn import venn2

dataSet={'10':18741,'01':12087,'11':5603} ##韦恩图,键必须固定为 10 01 11
color=['#ff9a00','#00b8a9','#f6416c']  ##设置颜色

fig,ax=plt.subplots()
v=venn2(
    subsets = dataSet, 
    set_labels = ('present in A2', 'present in At'),
    ax=ax
)
# batch change color of circol
for id,c in zip(dataSet.keys(),color):
    v.get_patch_by_id(id).set_color(c)

#set title of figure    
ax.set_title(
    'A2 vs At',
    fontdict={
        'size':16
    }
)
#add text annotion 
ax.text(-0.1,
        -0.7,
        r'7258 loci',
       fontdict={
           'size':14
       }
       )
fig.savefig('/public/home/zpliu/work/Alternative/result/Gh_result/CO31_32_result/evolution2/A2_vs_At/AS_gene.png', dpi=150, bbox_inches="tight")

Last updated