[NTG-context] MP figure continuation

Mikael Sundqvist mickep at gmail.com
Fri Jan 6 15:53:41 CET 2023

On Fri, Jan 6, 2023 at 3:43 PM Alexandre Christe via ntg-context
<ntg-context at ntg.nl> wrote:
> 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.


u:=3cm ;

def vdwbas(expr x) = abs(x-round x) enddef ;

def vdw(expr n,x) =
  if n = 0:
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 ;

draw function(1,"x","vdw(0,x)",epsed(-1),epsed(1),1/1000) scaled u ;

draw function(1,"x","vdw(1,x)",epsed(-1),epsed(1),1/1000) scaled u ;

draw function(1,"x","vdw(2,x)",epsed(-1),epsed(1),1/1000) scaled u ;

draw function(1,"x","vdw(3,x)",epsed(-1),epsed(1),1/1000) scaled u ;

draw function(1,"x","vdw(1,x)+vdw(0,x)",epsed(-1),epsed(1),1/1000) scaled u ;

draw function(1,"x","vdw(2,x)+vdw(1,x)+vdw(0,x)",epsed(-1),epsed(1),1/1000)
scaled u ;

draw function(1,"x","vdw(3,x)+vdw(2,x)+vdw(1,x)+vdw(0,x)",epsed(-1),epsed(1),1/1000)
scaled u ;

{\useMPgraphic{vanderwaerden0}}   {(a)}
{\useMPgraphic{vanderwaerden0}}   {(b)}
{\useMPgraphic{vanderwaerden1}}   {(c)}
{\useMPgraphic{vanderwaerden01}}  {(d)}
{\useMPgraphic{vanderwaerden2}}   {(e)}
{\useMPgraphic{vanderwaerden012}} {(f)}
{\useMPgraphic{vanderwaerden3}}   {(g)}


More information about the ntg-context mailing list