I had this issue, and found almost exactly the same problem on Stack Overflow ([link](https://stackoverflow.com/questions/70656115/best-location-for-legend-is-covering-text)) Briefly, the pyplot.legend does not try to avoid pyplot.text. Here is a minimal example: ``` import matplotlib.pyplot as plt x = [1, 2] plt.plot(x, x, label='plot name') plt.gca().text(0.05, 0.95, 'some text', transform=plt.gca().transAxes, verticalalignment='top') plt.gca().legend(loc='best') plt.show() ``` resulting in legend overlaying the text like this:  BTW, my matplotlib version is 3.4.3