From: Taco Hoekwater <taco@bittext.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: [NTG-context] Re: The graph is not visible.
Date: Thu, 25 Apr 2024 13:31:48 +0200 [thread overview]
Message-ID: <F5ACA1AB-EA56-4356-BFB0-214DDADD17AE@bittext.nl> (raw)
In-Reply-To: <CACyK-er11ojmcxTFuqmPVQ3ArHYwmhjJ_gVRoBu7gxkq3iRg_A@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 99 bytes --]
H Fabrice,
You did not provide a good minimum test because the graph by itself renders fine:
[-- Attachment #2: fabr.pdf --]
[-- Type: application/pdf, Size: 7453 bytes --]
[-- Attachment #3: Type: text/plain, Size: 3117 bytes --]
Best wishes,
Taco
(if all else fails, you can replace \startMPcode with \startMPpage and generate a standalone graph that way)
> On 25 Apr 2024, at 12:27, Fabrice Couvreur <fabrice1.couvreur@gmail.com> wrote:
>
> Hi,
> I don't know if I can explain the problem I'm having. I made a project with 14 chapters. In each of them, there are graphics embedding metapost code. I proceed as follows : I compile each chapter alone with lmtx then I compile the project containing the 14 chapters. I didn't encounter any problems except with a graphic from the last chapter. It is indeed in chapter 14 but not in the project ! I give the code for this graph.
> Thanks.
> Fabrice
>
> \startMPcode
>
> interim linejoin := mitered;
> interim ahangle := 30;
> numeric u, pi;
>
> pi = 3.141592653589793;
> u = 1.5cm;
>
> vardef graph_of_function (suffix f) (expr xmin, xmax, xsep) =
> for x = xmin step xsep until xmax: (x, f(x)) .. endfor (xmax, f(xmax))
> enddef ;
>
> vardef vline (suffix f, g) (expr x) = (x, min(f(x), g(x))) -- (x, max(f(x),g(x))) enddef;
>
> vardef area_between_functions (suffix f, g)(expr a, b, xsep) =
> buildcycle(graph_of_function(f, a, b, xsep), vline(f, g, b),
> reverse graph_of_function(g, a, b, xsep), reverse vline(f, g, a))
> enddef;
>
> vardef xaxis (expr xmin, xmax) = (xmin, 0) -- (xmax, 0) enddef ;
> vardef yaxis (expr ymin, ymax) = (0, ymin) -- (0, ymax) enddef ;
>
>
> xmin:=-pi/2; xmax := 3*pi/2;
> ymin := -1.5; ymax := 5;
>
>
> vardef f(expr x)= exp(-x)*(-cos(x)+sin(x)+1) enddef;
> vardef g(expr x)=-exp(-x)*cos(x) enddef;
> path C_f, C_g;
> C_f = graph_of_function(f,xmin, xmax, .1);
> C_g = graph_of_function(g, xmin, xmax, .1);
>
> a := xpart(C_f intersectionpoint C_g);
> b := xpart(reverse C_f intersectionpoint reverse C_g);
>
> fill (area_between_functions(f, g, a, b, 0.1)) scaled u withcolor 0.4[white, blue];
> draw C_f scaled u withcolor blue;
> draw C_g scaled u withcolor blue;
>
>
> \stopMPcode
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___________________________________________________________________________________
—
Taco Hoekwater E: taco@bittext.nl
genderfluid (all pronouns)
[-- Attachment #4: Type: text/plain, Size: 511 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2024-04-25 11:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-25 10:27 [NTG-context] " Fabrice Couvreur
2024-04-25 11:31 ` Taco Hoekwater [this message]
2024-04-25 14:08 ` [NTG-context] " Fabrice Couvreur
2024-04-25 14:31 ` Hans Hagen
2024-04-25 14:32 ` Taco Hoekwater
2024-04-25 14:55 ` Fabrice Couvreur
2024-04-25 21:12 ` Fabrice Couvreur
2024-04-26 7:20 ` Taco Hoekwater
2024-04-26 8:32 ` Aditya Mahajan
2024-04-26 10:22 ` Fabrice Couvreur
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=F5ACA1AB-EA56-4356-BFB0-214DDADD17AE@bittext.nl \
--to=taco@bittext.nl \
--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).