samestats.py 文件源码

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

项目:same-stats-different-graphs 作者: jmatejka 项目源码 文件源码
def show_scatter(df, xlim=(-5, 105), ylim=(-5, 105), color="black", marker="o", reg_fit=False):
    """Create a scatter plot of the data

    Args:
        df (pd.DataFrame):      The data set to plot
        xlim ((float, float)):  The x-axis limits
        ylim ((float, float)):  The y-axis limits
        color (str):            The color of the scatter points
        marker (str):           The marker style for the scatter points
        reg_fit (bool):         Whether to plot a linear regression on the graph
    """
    sns.regplot(
        x="x",
        y="y",
        data=df,
        ci=None,
        fit_reg=reg_fit,
        marker=marker,
        scatter_kws={"s": 50, "alpha": 0.7, "color": color},
        line_kws={"linewidth": 4, "color": "red"})
    plt.xlim(xlim)
    plt.ylim(ylim)
    plt.tight_layout()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号