Get startedGet started for free

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.

This exercise is part of the course

Case Studies in Statistical Thinking

View Course

Exercise 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().

Hands-on interactive exercise

Have a go at this exercise by completing this sample 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')
____
Edit and Run Code