I've just started to learn to use python. I'm using anaconda python 3.5
and Rodeo to do a simple ggplot
.
from ggplot import *
df=pd.DataFrame({"Animal":["dog","dolphin","chicken","ant","spider"],"Legs":[4,0,2,6,8]})
p=ggplot(df, aes(x="Animal", weight="Legs")) + geom_bar(fill='blue')
p
ggsave("test.png",p)
Everything works fine before the 5th line. I got the plot as I wanted. But I got an error when I tried to save the plot:
NameError: name 'ggsave' is not defined
It seems that there's no ggsave function in ggplot module? The ggplot version is 0.11.1. Am I missing something here?
You can use:
p.save('test.png')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With