如何使用matplotlib编写版权信息
我正在用matplotlib制作一些图表,我想在图像的底部写上版权信息和我的网站地址。
比如说:
© ACME Corp www.example.com
有没有人知道我该怎么做呢?
3 个回答
1
plt.text(1,-1, 'Copyright: \xa9 Rafael Valero-Fernandez 2023',
horizontalalignment='right',
verticalalignment='bottom')
看起来是这样的:
我这边的所有代码:
# library
import matplotlib.pyplot as plt
from matplotlib_venn import venn3
name_file = "venn_diagram_purpose"
# Use the venn3 function
# Make a Basic Venn
plt.close('all')
v = venn3(subsets=(1, 1, 1, 1, 1, 1, 1),
set_labels = ('Skills',
'Opportunity',
'Interest'))
v.get_label_by_id('111').set_text('Destiny')
v.get_label_by_id('100').set_visible(False)
v.get_label_by_id('010').set_visible(False)
v.get_label_by_id('001').set_visible(False)
v.get_label_by_id('110').set_visible(False)
v.get_label_by_id('011').set_visible(False)
v.get_label_by_id('101').set_visible(False)
""" v.get_patch_by_id('111').set_color('blue')
v.get_patch_by_id('100').set_color('white')
v.get_patch_by_id('010').set_color('white')
v.get_patch_by_id('001').set_color('white')
v.get_patch_by_id('110').set_color('white')
v.get_patch_by_id('011').set_color('white')
v.get_patch_by_id('101').set_color('white') """
# Add title and annotation
plt.title("Where is your destiny?")
plt.text(1,-1, 'Copyright: \xa9 Rafael Valero-Fernandez 2023',
horizontalalignment='right',
verticalalignment='bottom')
plt.show()
plt.savefig(f'{name_file}.png')
3
要在图形的坐标轴区域外写文字,可以使用 figtext 这个功能。
0