【发布时间】:2020-03-29 10:43:38
【问题描述】:
我正在尝试将数据值添加到 matplotlib 行的末尾。这是我的代码:
fig, ax = plt.subplots(1, 1)
anz_df.plot(legend=True, ax=ax, figsize= (16,8))
ax.set_title("Number of confirmed cases between Australian' States vs New Zealand")
ax.set_ylabel('Number of confirmed Cases')
ax.set_xlabel('Date')
for line, name in zip(ax.lines, anz_df.columns):
y = line.get_ydata()[-1]
ax.annotate(name, xy=(1,y), xytext=(6,0), color=line.get_color(),
xycoords = ax.get_yaxis_transform(), textcoords="offset points",
size=14, va="center")
但是,我想在每行的末尾添加数据值。
感谢任何想法。
【问题讨论】:
-
关于悬停 - 检查 Plotly。
-
我会看看这些库。谢谢
标签: python matplotlib annotate