更改图例上的名字
我正在尝试更改这个情节传说中的名字。在大熊猫中使用此代码,我会收到此错误消息(下图)。该代码的第一部分有效,但与它不喜欢的组合部分有关。
plot3 + labs(colour = 'Location area', lables = c('Urban', 'Rural', 'No data'))
错误信息;
NameError: name 'c' is not defined
我正在寻找的是这个情节具有“位置区域”的标题,而1,2和3的标题则被更名为“ Urban”,“乡村”,而没有数据”。 是否需要更多数据/信息
I am trying to change the names on my legend of this plot. Using this code in pandas i get this error message (below). The first part of this code works but its something to do with the combine part that it doesnt like.
plot3 + labs(colour = 'Location area', lables = c('Urban', 'Rural', 'No data'))
error message;
NameError: name 'c' is not defined
What i am looking for is this plot to have the lengend title of 'Location area' and the 1,2 and 3 to be renamed 'Urban', 'Rural' and No data'. Let me know if more data/info is needed for this
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
传奇密钥标签是通过
标签
scale> scale
的参数设置的。但是主要问题是您使用c()
是R代码。当您使用plotnine
和python时,您必须使用方括号:使用基于
mtcars
的简单示例:The legend key labels are set via the
labels
argument of thescale
. But the main issue is that you usec()
which is R code. As you are usingplotnine
and Python you have to use square brackets:Using a simple example based on
mtcars
: