Function to orchestate image and axis generation for the tree Specifically, this creates the axes, tweaks them as necessary, creates node text, creates rectangles for the nodes, generates the lines, and then generates the legend. It takes no arguments as it obtains t
(self)
| 203 | plt.legend(handles=patches, frameon=False) |
| 204 | |
| 205 | def generate_image(self): |
| 206 | """Function to orchestate image and axis generation for the tree |
| 207 | |
| 208 | Specifically, this creates the axes, tweaks them as necessary, |
| 209 | creates node text, creates rectangles for the nodes, generates the |
| 210 | lines, and then generates the legend. It takes no arguments as it |
| 211 | obtains the majority of this information from data passed to the |
| 212 | FairTreeGraph object. |
| 213 | |
| 214 | Returns |
| 215 | ------- |
| 216 | tuple(matplotlib.figure, matplotlib.axis) |
| 217 | The figure and axis associated with the FairTreeGraph |
| 218 | |
| 219 | """ |
| 220 | fig, ax = plt.subplots() |
| 221 | fig.set_size_inches(20, 6) |
| 222 | ax = self._tweak_axes(ax) |
| 223 | self._data.apply(self._generate_text, args=[ax], axis=1) |
| 224 | self._generate_rects(ax) |
| 225 | self._data.apply(self._generate_lines, args=[ax], axis=1) |
| 226 | self._generate_legend(ax) |
| 227 | return (fig, ax) |