How to setup matplotlib on Cloud9 properly?

python

#1

I have done some research online to see how to get matplotlib to work with Cloud9.However, I cannot get it to work. I wonder if anyone can help me with this. Below is the code I have so far.

import os
import matplotlib
# Force matplotlib to not use any Xwindows backend.
matplotlib.use('Agg')
import matplotlib.pyplot as plt


squares = [1, 4, 9, 16, 25]
plt.plot(squares)
print("hi")
plt.show()
os.getenv('IP', '0.0.0.0')
os.getenv('PORT', '8080')

#2

I haven’t tried it myself yet but I found this on stackoverflow:

matplotlib in c9