How to insert non overlapping text in matplotlib?
I am trying to insert power flow results in a network plot created with matplotlib. Some buses are so close that labelling the names along with power flow results is proving to be a big headache because text overlap is making some portions unreadable.
Is there some way to use the bounding box of the text to determine whether the text overlaps the plot lines and/or some other text?
This is a repost of a request posted in stack overflow.
How are you creating the network plot locations? I experimented with networkx on the weekend and found that you must run a layout algorithm with multiple passes in order to prevent overlapping buses and text. https://github.com/jtrain/psse_sld_viewer
I am using an initial mapping (as indicated in the 'move buses in slider diagram' post as a start off point. I now trying to put together an algorithm to place the power flow results without overlapping either on the plot lines or previously inserted text.
I can't figure out a way to obtain the bounding box of the plotted items. My understanding of the underlying matplotlib classes/functions does not seem to be up to the task. By the way, the add comment feature does not seem to be working in IE9.