- #40 Basic scatterplot with seaborn
- #40 Scatterplot with regression | 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()
Pingback: Popular Links of Data Visualization – pmlogy
To get this graph to work I added:
import matplotlib.pyplot as plt
and then uncommented and corrected from
# sns.plt.show()
to
# plt.show()
Cool website!