python - 避免重叠注释
问题描述
我在下面有一个注释散点的代码
for x,y in zip(xs,ys):
label = "{:.2f}%".format(y)
plt.annotate(label, # this is the text
(x,y), # this is the point to label
textcoords="offset points", # how to position the text
xytext=(0,10), # distance from text to points (x,y)
ha='center') # horizontal alignment can be left, right or center
我的结果图是这样的:我有很多点靠得太近,导致注释重叠。任何人都知道如何根据我当前的代码来避免它?
解决方案
推荐阅读
- c# - 如何将 acr_values 添加到 /user/connect/token 请求正文?(.net 核心)
- node.js - 更改格式时是否可以保留日期类型?
- authentication - IAM系统中的API-Token功能
- github - 创建个人访问令牌
- r - 在 R 中编写函数以填充空白值时,如何修复“级别 1 没有此类索引”?
- javascript - 将日期转换为字符串,而不是 Object
- parameters - xgboost 模型中 n_estimators 的默认值是多少?
- tensorflow - 自定义损失函数以防止不对称混淆矩阵
- google-sheets-formula - 如何通过 IMPORTXML 从 Google 表格中的图书网站获取维度
- html - 如何用 CSS 设置形状?