CommencerCommencer gratuitement

EDA: Plot ECDFs of active bout length

An active bout is a stretch of time where a fish is constantly moving. Plot an ECDF of active bout length for the mutant and wild type fish for the seventh night of their lives. The datasets are in the numpy arrays bout_lengths_wt and bout_lengths_mut. The bout lengths are in units of minutes.

Cet exercice fait partie du cours

Case Studies in Statistical Thinking

Afficher le cours

Instructions

  • Import the module dc_stat_think as dcst so you have its functions available.
  • Generate the x and y values for plotting the ECDF of the wild type fish (bout_lengths_wt) using dcst.ecdf(). Store the result in numpy arrays named x_wt and y_wt.
  • Do the same for the the mutant fish (bout_lengths_mut), storing the result in numpy arrays named x_mut and y_mut.
  • Use plt.plot() to plot the two ECDFs as dots on the same plot. Be sure to specify the keyword arguments marker='.' and linestyle='none'.
  • Show your plot using plt.show().

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Import the dc_stat_think module as dcst
____

# Generate x and y values for plotting ECDFs
x_wt, y_wt = ____
____, ____ = ____

# Plot the ECDFs
_ = ____(____, ____, ____='.', linestyle='____')
_ = ____(____, ____, ____='.', linestyle='____')

# Make a legend, label axes, and show plot
_ = plt.legend(('wt', 'mut'))
_ = plt.xlabel('active bout length (min)')
_ = plt.ylabel('ECDF')
____
Modifier et exécuter le code