ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Mikael Sundqvist via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Mikael Sundqvist <mickep@gmail.com>
Subject: Re: MP figure continuation
Date: Fri, 6 Jan 2023 15:53:41 +0100	[thread overview]
Message-ID: <CAHy-LL__NAJ6rEixXr55Ly0cBnWeo0bbxQEHX7t_-Z_6odbOWg@mail.gmail.com> (raw)
In-Reply-To: <CALC5-UJgsR+APNb-=yb2oi-dPFcztpdK4w1wwG5mnXHZRZkPwQ@mail.gmail.com>

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

/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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2023-01-06 14:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-06 14:43 Alexandre Christe via ntg-context
2023-01-06 14:53 ` Mikael Sundqvist via ntg-context [this message]
2023-01-06 14:58 ` Gavin via ntg-context
2023-01-06 15:02   ` Alexandre Christe via ntg-context
2023-01-07  2:35 ` Alan Braslau via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHy-LL__NAJ6rEixXr55Ly0cBnWeo0bbxQEHX7t_-Z_6odbOWg@mail.gmail.com \
    --to=ntg-context@ntg.nl \
    --cc=mickep@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).