indice[s_,i_]:=(Subscript[s, i])

indice["x",3-1]

Clear[pointFixe];pointFixe[g_,x0_,a_,n_]:=Module[{x},x=NestList[g,x0,n];Graphics[Line[Join[{{x[[1]],a},{x[[1]],x[[2]]}},
	Flatten[Table[{{x[[i]],x[[i]]},{x[[i]],x[[i+1]]}},{i,2,n}],1]]]]]

pointFixeLabels[g_,x0_,n_]:=Module[{x},x=NestList[g,x0,n];Ticks->{
	Table[{x[[i]],indice["x",i-1]},{i,n+1}],
		Table[{x[[i]],indice["x",i-1]},{i,n+1}]}]

Clear[figPointFixe];figPointFixe[g_, x0_,a_,b_,n1_,n2_]:=Module[{h},h=((b-a)/30);Show[{
		Graphics[{Dashing[{0.01,0.01}],Line[{{a,a},{b,b}}],Text["y=x",{b- 2h,b-h}]}],
			pointFixe[g,x0,a,n1],
		Plot[g[x],{x,a,b},PlotRange->{a,b}],
Graphics[Text["y=g(x)",{b-h,g[b]+2h}]]},
Axes->True,pointFixeLabels[g,x0,n2],AspectRatio->Automatic,AxesOrigin->{a,a},PlotRange->{{a-h,b+h},{a-h,b+h}}, ImageSize->{400,400}]]

figPointFixe[Cos,0.78,0.7,0.8,10,4];

figPointFixe[Cos,0.72,0.7,0.8,10,4];

Clear[g]; g[x_]:=4-Log[x]

figPointFixe[g,3,2.89,3.01,10,4];

Clear[g];g[x_]:=5-(2^x)

figPointFixe[g,1.5,-8,6,6,5];