from numpy import *
from matplotlib.pyplot import *
from mpl_toolkits.axes_grid.axislines import SubplotZero
pdf = lambda c,m,x: sqrt(c/(2.*pi)) * exp(-c*.5 / (x-m)) / (x-m)**1.5
fig = figure(figsize=(5,5))
ax = SubplotZero(fig,111)
fig.add_subplot(ax)
for direction in ["xzero","yzero"]:
ax.axis[direction].set_visible(True)
ax.axis[direction].set_axisline_style("->")
for direction in ["top","bottom","left","right"]:
ax.axis[direction].set_visible(False)
ax.axis["yzero"].set_axis_direction("left")
ax.grid(False)
ax.minorticks_on()
x = linspace(.001,3,150)
ax.plot(x,pdf(.5,0.,x),'r',lw=2,label=r'$c=1/2$')#'$c={}^1\!/_2$')
ax.plot(x,pdf(1.,0.,x),'k',lw=2,label=r'$c=1$')
ax.plot(x,pdf(2.,0.,x),'c',lw=2,label=r'$c=2$')
ax.plot(x,pdf(4.,0.,x),'b',lw=2,label=r'$c=4$')
ax.plot(x,pdf(8.,0.,x),'g',lw=2,label=r'$c=8$')
ax.set_ylim(0,1.01)
ax.set_xlim(0,3)
ax.legend(loc=0,frameon=False)
ax.axis["xzero"].label.set_text(r'x')
#ax.axis["yzero"].label.set_text(r'$f_x(x;\mu,\sigma)=\frac{1}{x\sigma\sqrt{2\pi}}e^{-\frac{\left(\ln x-\mu\right)^2}{2\sigma^2}}$')
fig.savefig("Levy0_distributionPDF.svg",bbox_inches="tight",pad_inches=.15)