Sending a new line in venn diagram of mpld3

108 views Asked by At

I am trying to import a venn diagram with some labels in mpld3.When the diagram is rendered on react page,the newline is no more appeared.Following is the code:

fig, ax = plt.subplots(figsize = (5,6))
    
    ax.set_title('Common values for the years ', fontsize=12)
    v = venn2([set(list_topics_y1), set(list_topics_y2)],
    set_labels=[str(year1), str(year2)])
    v.get_patch_by_id('10').set_alpha(0.7)
    v.get_patch_by_id('10').set_color('purple')
    v.get_patch_by_id('01').set_alpha(0.9)
    v.get_patch_by_id('01').set_color('yellow')
    v.get_patch_by_id('11').set_alpha(0.4)
    v.get_patch_by_id('11').set_color('brown')
    v.get_label_by_id('10').set_text('\n'.join(list_topics_y1))
    label = v.get_label_by_id('10')          
    label.set_fontsize(7) 
    # v.get_label_by_id('01').set_text('\\n'.join(dog_only_names))
    # v.get_label_by_id('11').set_text('\\n'.join(overlap_names))
    c = venn2_circles([set(list_topics_y1), set(list_topics_y2)],
                  linestyle='solid')
plt.axis('off')
    html_graph = mpld3.fig_to_html(fig,template_type='general')

How do I set the labels in such a way a newline appears?Also, the axes are appeared even when I turn the axes off.How do I remove it?

0

There are 0 answers