Skip to content

Instantly share code, notes, and snippets.

@Raudcu
Raudcu / subtitles_in_legend.py
Last active January 9, 2023 19:25
Custom legend handler to add subtitles within a matplotlib legend
# Adapted to python3 from the accepted answer on https://stackoverflow.com/questions/38463369/subtitles-within-matplotlib-legend
# Legend guide: https://matplotlib.org/3.1.0/tutorials/intermediate/legend_guide.html
import matplotlib.text as mtext
class LegendTitle(object):
def __init__(self, text_props=None):
self.text_props = text_props or {}
super(LegendTitle, self).__init__()