我与Matplotlib, legend with multiple different markers with one label有'相似'问题。由于这个问题Combine two Pyplot patches for legend,我能够实现以下目标。具有相同标签的不同散点图标记
fig = pylab.figure()
figlegend = pylab.figure(figsize=(3,2))
ax = fig.add_subplot(111)
point1 = ax.scatter(range(3), range(1,4), 250, marker=ur'$\u2640$', label = 'S', edgecolor = 'green')
point2 = ax.scatter(range(3), range(2,5), 250, marker=ur'$\u2640$', label = 'I', edgecolor = 'red')
point3 = ax.scatter(range(1,4), range(3), 250, marker=ur'$\u2642$', label = 'S', edgecolor = 'green')
point4 = ax.scatter(range(2,5), range(3), 250, marker=ur'$\u2642$', label = 'I', edgecolor = 'red')
figlegend.legend(((point1, point3), (point2, point4)), ('S','I'), 'center', scatterpoints = 1, handlelength = 1)
figlegend.show()
pylab.show()
但是,我的两个(金星和火星)标记在图例中重叠。我尝试玩handlelength,但这似乎没有帮助。任何建议或意见都会有所帮助。
您还可以调整列间距以将它们靠得更近。 – Blink