What predicts animal longevity?
Let's pull this all together & port some MATLAB code over to Python.
A colleague sent you their MATLAB analysis of data from "AnAge: The Animal Ageing and Longevity Database." This database contains longevity data for over 4000 vertebrate animals, along with other data related to longevity.
You've loaded up the data in Python, and now you want to understand the relationship between the maximum longevity (stored in the numpy array max_longevity) of animals and the number of litters they produce each year (in litters_per_year). You've already imported pyplot and assigned it to the variable plt.
You have their MATLAB code plotting this relationship, but you need to port it over to Python.
Deze oefening maakt deel uit van de cursus
Python for MATLAB Users
Oefeninstructies
- Convert comments to Python syntax.
- Replace MATLAB plotting functions with their corresponding
pyplotfunctions. - Show your plot.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
% Initialize the figure
figure
% Make the scatter plot
scatter(litters_per_year, max_longevity)
% Add axis labels
xlabel('Litters/Clutches per year')
ylabel('Maximum longevity (yrs)')
____.____()