Skip to content

Instantly share code, notes, and snippets.

@haoliplus
Created May 13, 2016 07:00
Show Gist options
  • Save haoliplus/f6bc510c72326a127c27e8818b4b1649 to your computer and use it in GitHub Desktop.
Save haoliplus/f6bc510c72326a127c27e8818b4b1649 to your computer and use it in GitHub Desktop.
Using matplotllib to plot
import matplotlib
# if your environment has no desktop.
matplotlib.use('Agg')
import matplotlib.pyplot as plt
# A scatter map.
plt.figure(figsize=(width,height))
plt.scatter(x,y)
plt.show
plt.savefig('scatter.png')
# A hist map
n, bins, patches = plt.hist(x,bins=10,range=None,normed=False, normed=1, facecolor='g', alpha=0.75)
plt.xlabel('Rate')
plt.ylabel('Count')
plt.title('img_rate')
plt.axis([x_min, x_max,
y_min, y_max])
plt.grid(True)
# plt.show()
plt.savefig('hist.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment