Remove implicit dependence on matplotlib