Skip to content

Instantly share code, notes, and snippets.

@willthames
Created April 2, 2012 10:25
Show Gist options
  • Save willthames/2282425 to your computer and use it in GitHub Desktop.
Save willthames/2282425 to your computer and use it in GitHub Desktop.
Use matplotlib, pandas, numpy etc to plot an effort vs value CSV file
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
from pandas import *
from pylab import figure, show
def trimnum(n):
if abs(n - int(n)) > 0.05:
return "%.1f" % n
else:
return "%d" % n
df = read_csv('effortvalue.csv')
fig = plt.figure()
fig.set_facecolor('white')
plt.axis([0,1.05,0,1.05], 'off')
axes = plt.axes(axisbg='#f0f0f0')
axes.get_xaxis().set_ticks([])
axes.get_yaxis().set_ticks([])
plt.scatter(df['Effort'], df['Value'])
plt.axhline(y=0.5, color='r')
plt.axvline(x=0.5, color='r')
plt.xlabel('Effort')
plt.ylabel('Value')
plt.title('Effort vs Value - March 2012')
plt.plot([0,1],[0,1],'g--')
for i, r in df.iterrows():
plt.annotate(trimnum(r['Task id']), (r['Effort']+0.01, r['Value']+0.01))
show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment