Вы можете добавить строку к легенде, передав ее legend()
import matplotlib.pyplot as plt
fig, ax1 = plt.subplots()
x = [2, 4, 6, 2, 4, 7, 6, 4, 4, 4, 4]
n, bins_edges, patches = ax1.hist(x, log=True, bins='doane', color="red")
binwidth = bins_edges[1] - bins_edges[0]
mylabel = "Binwidth {}".format(binwidth)
ax1.legend([mylabel])
plt.show()
![enter image description here](https://i.stack.imgur.com/4x5dO.png)