Matplotlib:figlegend仅打印fir

2024-05-01 22:26:37 发布

您现在位置:Python中文网/ 问答频道 /正文

我试着打印一个只有一行的字母,但我只收到第一封信。我有以下脚本来制作这个情节:

from pylab import *
k = plot((0, 1),(1, 1))
figlegend((k),('Limit'),loc='lower center')
savefig('test.pdf')

输出为:output

我做错什么了?(还是虫子?)


Tags: fromtestimport脚本pdfplot字母lower
1条回答
网友
1楼 · 发布于 2024-05-01 22:26:37

我还没有弄清楚这是matplotlib中的一个bug还是有意的(出于某种原因),但是为了获得完整的图例标签,您需要在标签列表中留下一个尾随逗号:

figlegend((k),('Limit',),loc='lower center')

更改该行和代码:

from pylab import *
k = plot((0, 1),(1, 1))
figlegend((k),('Limit',),loc='lower center')
savefig('test.pdf')

生成图形:

full legend label

相关问题 更多 >