更改散点图点的样式
继续探索 Seaborn 的 mpg 数据集,看看车辆加速能力("acceleration")与燃油效率("mpg")之间的关系。它们是否会因原产国("origin")而异?
注意,"acceleration" 变量表示从 0 到每小时 60 英里的加速时间,单位为秒。数值越大,表示加速越慢。
本练习是课程的一部分
Seaborn 数据可视化入门
练习说明
- 使用
relplot()和mpgDataFrame,创建一个散点图,x 轴为"acceleration",y 轴为"mpg"。根据原产国("origin")改变图中点的样式和颜色。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Import Matplotlib and Seaborn
import matplotlib.pyplot as plt
import seaborn as sns
# Create a scatter plot of acceleration vs. mpg
# Show plot
plt.show()