From: David Arnold <dwarnold45@cox.net>
Subject: Passing text to Metapost functions
Date: Sun, 25 Dec 2005 19:34:36 -0800 [thread overview]
Message-ID: <8B3296E7-0060-4D06-84AE-C3A5816A4F5E@cox.net> (raw)
All,
I'd like to do something like this:
create_axes(xmin,xmax,ymin,ymax,ux,uy)(x);
Where x will be a label for my x-axis. But once in a while it might
be t or u or some other thing such as "Days."
I want to use it like this:
beginfig(0);
%initialize window parameters
numeric xmin, xmax, xscl, ymin, ymax, yscl;
xmin:=-5;
xmax:=5;
xscl:=1;
ymin:=-5;
ymax:=5;
yscl:=1;
%initialize scale
numeric ux, uy;
(xmax-xmin)*ux=4in; (ymax-ymin)*uy=3in;
%create-axes function
vardef create_axes(expr xxmin, xxmax, yymin, yymax, uux, uuy)(text
xlbl)=
drawdblarrow (1.05*xxmin*uux,0)--(1.05*xxmax*uux,0);
label.rt(btex $xlbl$, (1.05*xxmax*uux,0));
drawdblarrow (0,1.05*yymin*uuy)--(0,1.05*yymax*uuy);
enddef;
create_axes(xmin,xmax,ymin,ymax,ux,uy)(x);
endfig;
end.
Two questions:
1. How can I do this in plain metapost?
2. What would be the "Context Way?"
next reply other threads:[~2005-12-26 3:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-26 3:34 David Arnold [this message]
2005-12-26 11:44 ` Hans Hagen
2005-12-26 18:04 ` David Arnold
2005-12-26 20:03 ` Willi Egger
2005-12-26 21:17 ` David Arnold
2005-12-27 8:09 ` Taco Hoekwater
2005-12-27 8:24 ` David Arnold
2005-12-27 8:58 ` Taco Hoekwater
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=8B3296E7-0060-4D06-84AE-C3A5816A4F5E@cox.net \
--to=dwarnold45@cox.net \
--cc=ntg-context@ntg.nl \
/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).