from numpy import linspace,log
from matplotlib.pyplot import *
lineEQ = lambda k,a: log(a)+(k-a)/a
x1 = linspace(0,7,100)
y1 = log(x1)
x2 = linspace(-1.5,4,3)
y2 = lineEQ(x2,1.5)
x3 = [1.5,2.5,2.5]
y3 = [][0],1.5), lineEQ(x3[0],1.5), lineEQ(x3[1],1.5)]
fig = figure(figsize=(5,3))
ax = fig.add_subplot(111)
for direction in ["left","bottom"]:
ax.spines[direction].set_position('zero')
ax.spines[direction].set_smart_bounds(True)
for direction in ["right","top"]:
ax.spines[direction].set_color('none')
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position('left')
ax.grid(False)
ax.set_xticks([0,1.5,3,4,5])
ax.set_yticks([-2,-1,1])
ax.set_ylim(-2.2,1.5)
ax.set_xlim(-1,5.5)
ax.plot(x1,y1,'g',linewidth=1.)
ax.plot(x2,y2,'k',linewidth=1.)
ax.plot(x3,y3,'k--',linewidth=1.)
ax.plot(1.5,log(1.5),'ro')
ax.text(5.5,.2,"x")
ax.text(0.1,1.5,"y")
ax.text(4,1,r"$f(x)=\ln(x)$")
ax.text(2,.175,"1",fontsize=7)
ax.text(2.6,.5,r"$f^'(x)=\frac{1}{x}$",fontsize=12)
ax.minorticks_on()
#fig.show()
fig.savefig("Logarithm_derivative.svg",bbox_inches="tight",\
pad_inches=.15)