Fixes to the API tutorial

* Make sure it leads to correctly working code
* Update matplotlib version
* Correct a few typos