Added a first, functional version based solely on matplotlib