When I create a plot with many curves it would be convenient to be able to label each curve at the right where it ends.
The result of plt.legend
produces too many similar colors and the legend is overlapping the plot.
As one can see in the example below the use of plt.legend
is not very effective:
import numpy as np
from matplotlib import pyplot as plt
n=10
x = np.linspace(0,1, n)
for i in range(n):
y = np.linspace(x[i],x[i], n)
plt.plot(x, y, label=str(i))
plt.legend(loc='upper right')
plt.show()
If possible I would like to have something similar to this plot:
or this: