0
當我嘗試使用包matplotlib_venn繪製維恩圖時遇到一些困難。matplotlib_venn:無法繪製某些值的維恩圖
詳細說明:
- 如果我使用數據[13,12,73,3,3,1,12],可以按預期
- 如果我使用數據產生的曲線圖[13487,12029,7314,336,371,17,12611],則不能生成圖形。
我該怎麼辦?
在此先感謝!
代碼:
import matplotlib.pyplot as plt
from matplotlib_venn import venn3, venn3_circles
weights = [13, 12, 73, 3, 3, 1, 12] # these weights work
# weights = [13487, 12029, 7314, 336, 371, 17, 12611] # these weights do not work
labels = ['100', '010', '110', '001', '101', '011', '111']
fig, axis = plt.subplots(1, 1)
v = venn3(subsets=weights, ax=axis)
for label, weight in zip(labels, weights):
v.get_label_by_id(label).set_text(str(weight))
fig.show()
這可能是一個錯誤,如果您將336更改爲大於365的數字,它可以工作。當你的get_label_by_id爲336時返回None。 – Dark