3

I am trying to make plot using ggplot in python. When I try to run, I get an error"

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

Everything else works. Was that a bug which was fixed in later versions?

user3922546
  • 187
  • 1
  • 6
  • 16

1 Answers1

2

You can try stat_smooth instead (shown with mtcars dataset):

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

Sandipan Dey
  • 21,482
  • 2
  • 51
  • 63