How about something like this: vardef stepfunc primary p = save q; path q; q:=(point 0 of p) for n=1 upto length p: --(xpart point (n-1) of p,ypart point n of p)--(point n of p) endfor; q enddef; and then use it in the following way: path p; p:=(0,0)--(10,10)--(15,5)--(20,10); draw p; draw stepfunc p withcolor blue; Troy