the closest I got to him, created an empty proxy artist. The problem in my opinion is that they are not left aligned, but the space for the (empty) marker still exists.
from matplotlib.patches import Rectangle
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 1, 100)
plot1, = plt.plot(x, x**2)
plot2, = plt.plot(x, x**3)
title_proxy = Rectangle((0,0), 0, 0, color='w')
plt.legend([title_proxy, plot1, title_proxy, plot2],
["$\textbf{title1}$", "label1","$\textbf{title2}$", "label2"])
plt.show()
source
share