Annotations do not appear the box

Hi All!

I displaying annotations, but for some reason they do not fit the box in some cases (see the attachment). Any idea why is it and how to fix it?

Thank you very much,

Interesting. Looks like you discovered a bug.

Would you mind sharing a reproducible example?

Sure. I dont have a straight-forward plotting to share the python code, I hope this is going to be enough Btw. sorry for the empty lines in the data of the graph, I couldnt figure out how to get rid of them.

The bug is present only when the resolution of the figure is low.