On Fri, Jan 6, 2023 at 3:43 PM Alexandre Christe via ntg-context
Dear list,
Is there a way to "continue" an MP figure? Like keeping the axes, etc. and just adding code to the figure?
Maybe I missed something, otherwise I'd find it super useful.
Thanks in advance and happy new year, Alex
Hi Alex, Maybe there are other ways, but one can use \includeMPgraphic. One simple example given below. /Mikael \starttext \startuseMPgraphic{vanderwaerdenbas} u:=3cm ; def vdwbas(expr x) = abs(x-round x) enddef ; def vdw(expr n,x) = if n = 0: vdwbas(x) else: vdwbas(x*pow(4,n))/pow(4,n) fi enddef ; path xaxis, yaxis ; xaxis = ((-1.1,0)--(1.1,0)) scaled u ; yaxis = ((0,-0.1)--(0,0.6)) scaled u ; drawarrow xaxis withpen pencircle scaled 0.25 ; drawarrow yaxis withpen pencircle scaled 0.25 ; \stopuseMPgraphic \startuseMPgraphic{vanderwaerden0} \includeMPgraphic{vanderwaerdenbas} draw function(1,"x","vdw(0,x)",epsed(-1),epsed(1),1/1000) scaled u ; \stopuseMPgraphic \startuseMPgraphic{vanderwaerden1} \includeMPgraphic{vanderwaerdenbas} draw function(1,"x","vdw(1,x)",epsed(-1),epsed(1),1/1000) scaled u ; \stopuseMPgraphic \startuseMPgraphic{vanderwaerden2} \includeMPgraphic{vanderwaerdenbas} draw function(1,"x","vdw(2,x)",epsed(-1),epsed(1),1/1000) scaled u ; \stopuseMPgraphic \startuseMPgraphic{vanderwaerden3} \includeMPgraphic{vanderwaerdenbas} draw function(1,"x","vdw(3,x)",epsed(-1),epsed(1),1/1000) scaled u ; \stopuseMPgraphic \startuseMPgraphic{vanderwaerden01} \includeMPgraphic{vanderwaerdenbas} draw function(1,"x","vdw(1,x)+vdw(0,x)",epsed(-1),epsed(1),1/1000) scaled u ; \stopuseMPgraphic \startuseMPgraphic{vanderwaerden012} \includeMPgraphic{vanderwaerdenbas} draw function(1,"x","vdw(2,x)+vdw(1,x)+vdw(0,x)",epsed(-1),epsed(1),1/1000) scaled u ; \stopuseMPgraphic \startuseMPgraphic{vanderwaerden0123} \includeMPgraphic{vanderwaerdenbas} draw function(1,"x","vdw(3,x)+vdw(2,x)+vdw(1,x)+vdw(0,x)",epsed(-1),epsed(1),1/1000) scaled u ; \stopuseMPgraphic \startplacefigure[reference=fig:vdw] \startcombination[nx=2,ny=4] {\useMPgraphic{vanderwaerden0}} {(a)} {\useMPgraphic{vanderwaerden0}} {(b)} {\useMPgraphic{vanderwaerden1}} {(c)} {\useMPgraphic{vanderwaerden01}} {(d)} {\useMPgraphic{vanderwaerden2}} {(e)} {\useMPgraphic{vanderwaerden012}} {(f)} {\useMPgraphic{vanderwaerden3}} {(g)} {\useMPgraphic{vanderwaerden0123}}{(h)} \stopcombination \stopplacefigure \stoptext