From: David Arnold <dwarnold45@cox.net>
Subject: drawdot fails?
Date: Sun, 18 Dec 2005 13:57:00 -0800 [thread overview]
Message-ID: <8C96D822-433E-490F-A84B-89FB0B6B3114@cox.net> (raw)
All,
I am wondering why my dots are not filled with the drawdot command.
\startuseMPgraphic{yeqx2}
%define function
vardef f(expr x)=
x*x
enddef;
%define clipping path
path cpath;
cpath:=(-5,-5)--(5,-5)--(5,5)--(-5,5)--cycle;
%create function path
path p; p:=(-5,f(-5));
for x=-5 step .1 until 5:
p:=p--(x,f(x));
endfor;
p:=p--(5,f(5));
%clip function path to clipping path
p:=p cutbefore cpath;
p:=reverse p;
p:=p cutbefore cpath;
%initialize scale
numeric u; 10u=2in;
%draw the grid
for k=-5u step 1u until 5u:
draw (k,-5u)--(k,5u) withcolor 0.85white;
draw (-5u,k)--(5u,k) withcolor 0.85white;
endfor;
%draw axes
drawdblarrow (-5.2u,0)--(5.2u,0);
drawdblarrow (0,-5.2u)--(0,5.2u);
%label axes
label.rt(btex $x$ etex, (5.2u,0));
label.top(btex $y$ etex, (0,5.2u));
label.bot(btex $5$ etex, (5u,0));
label.lft(btex $5$ etex, (0,5u));
%scale function path
p:=p scaled u;
%draw function path
drawdblarrow p withcolor blue;
%draw plotted points
for x=-2 step 1 until 2:
drawdot ((x,f(x)) scaled u) withpen pencircle scaled 4pt;
endfor;
\stopuseMPgraphic
\placefigure{The simple parabola.}{\useMPgraphic{yeqx2}}
next reply other threads:[~2005-12-18 21:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-18 21:57 David Arnold [this message]
2005-12-18 22:37 ` Taco Hoekwater
2005-12-18 22:56 ` David Arnold
2005-12-18 23:08 ` Taco Hoekwater
2005-12-18 23:15 ` David Arnold
2005-12-18 22:56 ` David Arnold
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=8C96D822-433E-490F-A84B-89FB0B6B3114@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).