Probably not quite what you are looking for, but you can do it (very) manually by placing patches and text on the chart. For instance:
import matplotlib.patches as mpatches import matplotlib.pyplot as plt fig, ax = plt.subplots() red_patch = mpatches.Patch(color='red', label='Foo') plt.legend(handles=[red_patch]) r1 = mpatches.Rectangle((0.1, 0.1), 0.18, 0.1, fill=False) r2 = mpatches.Rectangle((0.12, 0.12), 0.03, 0.06, fill=True, color='red') r3 = mpatches.Rectangle((0.15, 0.12), 0.03, 0.06, fill=True, color='blue') ax.add_patch(r1) ax.add_patch(r2) ax.add_patch(r3) ax.annotate('Foo', (0.2, 0.13), fontsize='x-large') plt.show()
source share