"""
module prequsites:
statsmodels installed by wheel
matplotlib
pandas
numpy
scipy
"""
from ggplot import *
import pandas as pd
# Error
# 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
df=pd.read_excel(r"C:\Users\anddyhua\Desktop\data.xlsx")
# Warning
"""
FutureWarning: pandas.tslib is deprecated and will be removed in a future version.
You can access Timestamp as pandas.Timestamp
pd.tslib.Timestamp
"""
# Error
"""
ImportError: cannot import name 'Timestamp' from 'pandas.lib'
"""
#print(df.head())
#meat_lng = pd.melt(meat[['date','beef','pork','broilers']],id_vars='Item_Type')
p=ggplot(df, aes(x='Item_Visibility', y='Item_MRP',color ='factor(Item_Type)')) + \
geom_point(size=10) + scale_x_continuous(name='Item Visibility', breaks = [i/100 for i in range(0,40,5)] ) + \
scale_y_continuous(name='Item MRP', breaks = range(0,270,30))+ theme_bw() + labs(title="Scatterplot") + \
facet_wrap(x='Item_Type')
#print (p)
#zoom in the plot image
p.save("data.png",height=15,width=20)