I am trying to draw a graph where each node is automatically placed one unit below its parent. Here is an example:

Each node represents some text surrounded by a bounding box, which may have a different size and may contain many values ββ(for example, field 3 is very long). I need to get the bottom coordinate of each node parent and draw a node 1 child below. However, my problem is that the reported coordinates of the bounding rectangles are incorrect. In the above example, I expect box 4 to be one lower than block 3, but the bottom coordinate of window 3 will be specified as -1.5 instead of -2.3. Box 4 is now too close to its parent. I am using Python 2.7.13. Here is my code:
import matplotlib.pyplot as plt
I managed to get closer to solving this problem by disabling the axis limits before drawing anything on the chart and setting manual limits as:
plt.xlim(-1, 1) plt.ylim(-6, 1) plt.autoscale(False)
Box 4 then is still not drawn exactly 1 unit below window 3 (but I think these are problems with filling), but it works almost as expected. However, setting the axis limits in advance is not ideal, because I need to automatically draw trees and I donβt know what borders of the graph should be at this point.
How can I get the correct bottom coordinate of each window and place a new block one unit lower?
source share