How to find the region of interest?

Can anyone tell how to detect the region where the legend lies?

The legend is created using matplotlib in the method Graph.print_graph(). You can read the docs on matplotlib for more information.