为什么这个示例来自here且可下载的here在Python 3中不适用于我:
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
red_patch = mpatches.Patch(color='red', label='The red data')
plt.legend(handles=[red_patch])
plt.show()
我只是得到一个空白的情节。我的Python和matplotlib版本分别是3.4.1和1.3.1。
我收到此错误代码:
UserWarning: No labeled objects found. Use label='...' kwarg on individual plots.
warnings.warn("No labeled objects found. "