这应该工作:
legend(numpoints=1)
顺便说一句,如果您添加行
legend.numpoints : 1 # the number of points in the legend line
到您的matplotlibrc文件中,那么这将是新的默认设置。
[另请参见散点图,具体取决于您的情节。]
API:链接到API文档

这应该工作:
legend(numpoints=1)
顺便说一句,如果您添加行
legend.numpoints : 1 # the number of points in the legend line
到您的matplotlibrc文件中,那么这将是新的默认设置。
[另请参见散点图,具体取决于您的情节。]
API:链接到API文档