Plotting the ECDF
You will now use your ecdf()
function to compute the ECDF for the petal lengths of Anderson's Iris versicolor flowers. You will then plot the ECDF. Recall that your ecdf()
function returns two arrays so you will need to unpack them. An example of such unpacking is x, y = foo(data)
, for some function foo()
.
Diese Übung ist Teil des Kurses
Statistical Thinking in Python (Part 1)
Anleitung zur Übung
- Use
ecdf()
to compute the ECDF ofversicolor_petal_length
. Unpack the output intox_vers
andy_vers
. - Plot the ECDF as dots. Remember to include
marker = '.'
andlinestyle = 'none'
in addition tox_vers
andy_vers
as arguments insideplt.plot()
. - Label the axes. You can label the y-axis
'ECDF'
. - Show your plot.
Interaktive Übung zum Anfassen
Probieren Sie diese Übung aus, indem Sie diesen Beispielcode ausführen.
# Compute ECDF for versicolor data: x_vers, y_vers
____, ____ = ____(____)
# Generate plot
# Label the axes
# Display the plot