Add a subtitle to legend handles.
(handles, labels, text)
| 1178 | |
| 1179 | |
| 1180 | def _legend_add_subtitle(handles, labels, text): |
| 1181 | """Add a subtitle to legend handles.""" |
| 1182 | import matplotlib.pyplot as plt |
| 1183 | |
| 1184 | if text and len(handles) > 1: |
| 1185 | # Create a blank handle that's not visible, the |
| 1186 | # invisibility will be used to discern which are subtitles |
| 1187 | # or not: |
| 1188 | blank_handle = plt.Line2D([], [], label=text) |
| 1189 | blank_handle.set_visible(False) |
| 1190 | |
| 1191 | # Subtitles are shown first: |
| 1192 | handles = [blank_handle] + handles |
| 1193 | labels = [text] + labels |
| 1194 | |
| 1195 | return handles, labels |
| 1196 | |
| 1197 | |
| 1198 | def _adjust_legend_subtitles(legend): |
no outgoing calls
no test coverage detected
searching dependent graphs…