added matplotlib magic for plotting