显示在传说标记边和面

问题描述 投票:1回答:1

我有附加的情节,和我一样的符号与绘制

ax.errorbar('mjd', 'aperMag3Ab', label='',        fmt='o',  color='k', ms=ms*1.4)
ax.errorbar('mjd', 'aperMag3Ab', label='WFCAM Y', fmt='o',  color='y', ms=ms)

基本上都在总重复8次。我目前正在与得到的传说:

plt.legend(loc="upper left", ncol=2, fontsize=labelsize/1.4, frameon=True)

如何在图例中获得外黑色圆圈(为WFCAM标签)和内黑色六边形(用于VIRCAM标签)吗? qazxsw POI

python matplotlib plot label legend
1个回答
2
投票

我没有访问您的数据,但如果你明确地设置在情节enter image description herefmtmarkeredgewidth,它应该在图例中显示为好。

作为最小的工作示例:

markeredgecolor

import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.errorbar([0], [0], yerr = [0.25], label='WFCAM Y', fmt='o', markeredgecolor ='black', markeredgewidth = 1, color='y', ms=10) ax.errorbar([0], [1], yerr = [0.25], label='WFCAM Y', fmt='p', markeredgecolor ='black', markeredgewidth = 1, color='r', ms=10) plt.legend()

© www.soinside.com 2019 - 2024. All rights reserved.