Okay so I solved this. This is due to the new version of matplotlib, which is 3.3.0 currently. I pip installed an older version which is 3.2.2, and the graph was printed out successfully.