開始使用免費開始

遺傳率的 EDA

陣列 bd_parent_scandens 包含物種 G. scandens 兩個親本的平均喙深(mm)。陣列 bd_offspring_scandens 包含對應親本之子代的平均喙深。陣列 bd_parent_fortisbd_offspring_fortis 也包含 G. fortis 的相同量測資訊。

請為兩個物種繪製平均子代喙深(y 軸)相對於平均親本喙深(x 軸)的散佈圖。使用關鍵字引數 alpha=0.5,以便看清重疊的點。

本練習屬於課程

Statistical Thinking in 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()
編輯並執行程式碼