In [2]:
%pylab inline
pylab.rcParams['figure.figsize'] = (3, 2)

import math
import matplotlib.pyplot as plt
import numpy as np

X=[i/10 for i in range(-100,101)]
Y=[1/(1+math.exp(-x)) for x in X]

fig, ax = plt.subplots()
ax.plot(X,Y)
ax.axhline(y=0.5, ls='dotted', color='k')
ax.axhline(y=0.0, ls='dotted', color='k')
ax.axhline(y=1.0, ls='dotted', color='k')
ax.axvline(0.0, color='k')


def heaviside(x):
    return 0.5*(np.sign(x) + 1)

Y_step=[heaviside(x) for x in X]
fig, ax = plt.subplots()
ax.plot(X,Y_step)
ax.axhline(y=0.5, ls='dotted', color='k')
ax.axhline(y=0.0, ls='dotted', color='k')
ax.axhline(y=1.0, ls='dotted', color='k')


Populating the interactive namespace from numpy and matplotlib
Out[2]:
<matplotlib.lines.Line2D at 0x7f4d15b444e0>