I am having trouble with the following plot:
created by the following code:
fig, ax = plt.subplots(figsize=(10, 6), dpi=80)
texts = []
for i, data_col in enumerate(data.columns.values):
ax.plot(data.index, data[data_col], color=tableau20[i], label=data_col)
texts.append(ax.text(max(data.index), data[data_col][-1], data_col, fontsize=11, color=tableau20[i]))
This is actually very close to the desired output, I am looking for a way to automatically adjust only the y-Position of the text so there will be no overlapping even if the values are changing (so no hard coded offset) What I found is the well working adjustText package from @Phlya, however I don't get the this solution to only adjust the y position, it will always shift the text on the x axis as well.
So this is the output I get with adding the line
adjust_text(texts, ax=ax, only_move=dict(points='y', text='y', objects='y'), autoalign='y')
is there a way to adjust the functions settings or any other way to achieve what i am looking for?