如何在ipython笔记本中设置和显示带有pandas绘图的x/y标签?

2024-09-29 22:15:59 发布

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

当我在ipython笔记本中绘制pandas系列并按照this的建议设置标签时,回答:

plt1=some_series.plot(marker='o', title='Count Distribution')
plt1.set_xlabel='x Count'
plt1.set_ylabel='y Frequecy'

然后评估细胞。图中显示了标题,但没有x或y标签。我怎样才能在ipython笔记本中做到这一点?在

以及克里斯皮对那篇文章的评论

Is there a particular reason why x and y labels can't be added as arguments to pd.plot()?

可能也是一个值得回答的相关问题。在

编辑: 谢谢,现在我知道是我的错了。但是它为什么不给我一个方法赋值的错误呢?在


Tags: pandasplottitlecountipython绘制笔记本some
1条回答
网友
1楼 · 发布于 2024-09-29 22:15:59

post you link中,它表明set_xlabel/set_ylabel是方法,而不是属性。因此,它们应该被称为(使用括号):

plt1 = some_series.plot(marker='o', title='Count Distribution')
plt1.set_xlabel('x Count')
plt1.set_ylabel('y Frequency')

相关问题 更多 >

    热门问题