官方文档
seaborn.
scatterplot
(*, x=None, y=None, hue=None, style=None, size=None, data=None, palette=None, hue_order=None, hue_norm=None, sizes=None, size_order=None, size_norm=None, markers=True, style_order=None, x_bins=None, y_bins=None, units=None, estimator=None, ci=95, n_boot=1000, alpha=None, x_jitter=None, y_jitter=None, legend='auto', ax=None, **kwargs)
参数真多
Draw a scatter plot with possibility of several semantic groupings.
The relationship between x
and y
can be shown for different subsets of the data using the hue
, size
, and style
parameters. These parameters control what visual semantics are used to identify the different subsets. It is possible to show up to three dimensions independently by using all three semantic types, but this style of plot can be hard to interpret and is often ineffective. Using redundant semantics (i.e. both hue
and style
for the same variable) can be helpful for making graphics more accessible.
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
tips = sns.load_dataset("tips")
# print(tips.keys)
# total_bill tip sex smoker day time size
print(tips.head())
# sns.scatterplot(data = tips, x="total_bill", y="tip")
sns.scatterplot(data = tips, x = "total_bill", y = "tip", hue = "sex",style = "sex")
# sns.scatterplot(data = tips, x = "total_bill", y = "tip", hue = "time", style = "time")
plt.show()