LoslegenKostenlos loslegen

EDA of heritability

The array bd_parent_scandens contains the average beak depth (in mm) of two parents of the species G. scandens. The array bd_offspring_scandens contains the average beak depth of the offspring of the respective parents. The arrays bd_parent_fortis and bd_offspring_fortis contain the same information about measurements from G. fortis birds.

Make a scatter plot of the average offspring beak depth (y-axis) versus average parental beak depth (x-axis) for both species. Use the alpha=0.5 keyword argument to help you see overlapping points.

Diese Übung ist Teil des Kurses

Statistical Thinking in Python (Part 2)

Kurs anzeigen

Anleitung zur Übung

  • Generate scatter plots for both species. Display the data for G. fortis in blue and G. scandens in red.
  • Set the axis labels, make a legend, and show the plot.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# 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()
Code bearbeiten und ausführen