PlottingOutliers.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:MarksPredictor-AzureMachineLearning 作者: keshav123456 项目源码 文件源码
def auto_scatter_outlier(df, plot_cols):
    import matplotlib.pyplot as plt
    outlier = [0,0,1,1] # Vector of outlier indicators
    color = ['DarkBlue','DarkBlue','Red','Red'] # vector of color choices for plot
    marker = ['x','o','o','x'] # vector of shape choices for plot
    for col in plot_cols: # loop over the columns
        fig = plt.figure(figsize=(6, 6))
        ax = fig.gca()
        ## Loop over the zip of the four vectors an subset the data and
        ## create the plot using the aesthetics provided
        for o, c, m in zip(outlier, color, marker):
            temp = df.ix[(df['outlier'] == o)]           
            if temp.shape[0] > 0:                    
                temp.plot(kind = 'scatter', x = col, y = 'Marks' , 
                           ax = ax, color = c, marker = m)                                 
        ax.set_title('Scatter plot of marks vs. ' + col)
        fig.savefig('scatter_' + col + '.png')
    return plot_cols
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号