Skip to content

Instantly share code, notes, and snippets.

@theanalyst
Created April 1, 2013 10:37
Show Gist options
  • Save theanalyst/5284221 to your computer and use it in GitHub Desktop.
Save theanalyst/5284221 to your computer and use it in GitHub Desktop.
from xkcdplot import XKCDify
import numpy as np
import pylab
import scipy.stats
import matplotlib.pyplot as plt
ax = pylab.axes()
x = np.linspace(0,5,100)
y = np.linspace(0,np.pi/2,100)
ax.plot(x,scipy.stats.norm.pdf(x,0,1),'r',lw=1,label="productivity")
ax.plot(x,scipy.stats.norm.pdf(x**2,4.5,1),'b',lw=1,label="fame on twitter")
ax.plot(x,0.5*scipy.stats.norm.pdf(x**3,1.5,0.8),'g',lw=1,label="time spent in making graphs explaining productivity")
ax.set_title("Productivity vs Twitter")
ax.set_ylabel("Productivity")
ax.set_xlabel('Hour wasted in life')
ax.text(3,-0.05,'(After Logging in Twitter)')
ax.annotate('(brief) Fame in Twitter \n= hours spent/no of RTs',
xytext=(2.5,0.3), xy=(2.1,0.4),
arrowprops=dict(facecolor='blue',shrink=0.1,width=2)
)
ax.annotate('Time spent in making up\ngraphs like this',xytext=(2.67,0.15),
xy=(1.22,0.22),
arrowprops=dict(facecolor='green',shrink=0.1,width=2))
ax.annotate('Productivity\n in life*',xy=(0.25,.39),xytext=(0.54,0.38),
arrowprops=dict(facecolor='red',shrink=0.1,width=2))
XKCDify(ax,xaxis_loc=0.0, yaxis_loc=0.0,
xaxis_arrow='+-', yaxis_arrow='+-',xlabel_inside=True,
expand_axes=True)
pylab.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment