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()
评论列表
文章目录