The line plt = ggplot(.... is not right, for a few reasons.
plt is the name you've given the pylab module. plt = will delete it!
data=df is a keyword argument (because of the data= part). They have to go after positional arguments. See the keyword entry of the Python glossary for details. You either need to make the first argument positional by taking out data=, or put it after the positional argument aes(x=x, y=y).
- the
ggplot call returns a ggplot object, not a pyplot-related thing. ggplot objects have draw() not show().
The developer himself shows here how it's meant to be done:
g = ggplot(df, aes(x=x, y=y)) +\
geom_line() +\
stat_smooth(colour='blue', span=0.2)
print(g)
# OR
g.draw()
That last line g.draw() returns a matplotlib figure object so you can also do:
fig = g.draw()
which will give you access to the matplotlib figure, if that's the sort of thing you want to do.