遗传力的探索性数据分析(EDA)
数组 bd_parent_scandens 包含物种 G. scandens 的双亲平均喙深(单位:mm)。数组 bd_offspring_scandens 包含相应子代的平均喙深。数组 bd_parent_fortis 和 bd_offspring_fortis 对 G. fortis 鸟类测量提供了同样的信息。
请为两个物种绘制散点图:以平均双亲喙深为 x 轴、平均子代喙深为 y 轴。使用关键字参数 alpha=0.5 以便更清楚地看到重叠的点。
本练习是课程的一部分
Python 统计思维(第 2 部分)
练习说明
- 为两个物种分别生成散点图。将 G. fortis 的数据用蓝色显示,G. scandens 用红色显示。
- 设置坐标轴标签,添加图例,并显示图形。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Make scatter plots
_ = ____(____, ____,
marker=____, linestyle=____, color=____, alpha=____)
_ = plt.plot(bd_parent_scandens, ____,
marker=____, linestyle=____, color=____, alpha=____)
# Label axes
_ = plt.____('parental beak depth (mm)')
_ = plt.____('offspring beak depth (mm)')
# Add legend
_ = plt.____(('G. fortis', 'G. scandens'), loc='lower right')
# Show plot
plt.show()