MCPcopy
hub / github.com/pydata/xarray / _legend_add_subtitle

Function _legend_add_subtitle

xarray/plot/utils.py:1180–1195  ·  view source on GitHub ↗

Add a subtitle to legend handles.

(handles, labels, text)

Source from the content-addressed store, hash-verified

1178
1179
1180def _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
1198def _adjust_legend_subtitles(legend):

Callers 1

_add_legendFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…