#40 Basic scatterplot | seaborn

Using seaborn, scatterplots are made using the regplot() function. Here is an example showing the most basic utilization of this function. You have to provide at least 2 lists: the positions of points on the X and Y axis. By default, a linear regression fit is drawn, you can remove it with fit_reg=False


# library & dataset
import seaborn as sns
df = sns.load_dataset('iris')

# use the function regplot to make a scatterplot
sns.regplot(x=df["sepal_length"], y=df["sepal_width"])
#sns.plt.show()

# Without regression fit:
sns.regplot(x=df["sepal_length"], y=df["sepal_width"], fit_reg=False)
#sns.plt.show()

Leave a Reply

Your email address will not be published.