geom_smooth选项缺少python中的ggplot

时间:2016-12-08 11:05:25

标签: python-2.7 python-ggplot

我正在尝试使用python中的ggplot制作情节。当我尝试运行时,我收到错误“

ggplot(data,aes(x='Average Credit Card Transaction',y='response'))+\ geom_smooth(se=False,span=0.2)+xlab("Average Credit Card Transaction")+\ ylab('Response')+\ ggtitle('Partial Dependence Plot \n Response Vs Average Credit Card transactions')

NameError: name 'geom_smooth' is not defined

其他一切都有效。这是一个在以后的版本中修复过的错误吗?

1 个答案:

答案 0 :(得分:0)

您可以尝试使用stat_smooth(与mtcars数据集一起显示):

from ggplot import *
ggplot(mtcars, aes('mpg', 'qsec')) + \
  geom_point(colour='red') + \
   stat_smooth(colour='blue', se=False, span=0.2) + \
   ggtitle("mtcars stat_smooth")

enter image description here