* [NTG-context] for loop not working in metapost
@ 2024-08-30 11:19 Shiv Shankar Dayal
2024-08-30 11:34 ` [NTG-context] " Mikael Sundqvist
0 siblings, 1 reply; 3+ messages in thread
From: Shiv Shankar Dayal @ 2024-08-30 11:19 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi,
I have plotted a log function and I want to draw an xy axis grid.
Below is the code
\starttext
\startMPcode
draw function(1,"x", "log(x)", .1, 10, .01) scaled 1cm;
for i = 0 upto 10:
draw (i*cm, -5cm) -- (i*cm, 5cm) dashed;
endfor;
for i = -5 upto 5:
draw (0, i*cm) -- (10cm, i*cm) dashed;
endfor;
\stopMPcode
\stoptext
My first for loop draws lines but the second gives me an error. Please help.
--
Respect,
Shiv Shankar Dayal
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* [NTG-context] Re: for loop not working in metapost
2024-08-30 11:19 [NTG-context] for loop not working in metapost Shiv Shankar Dayal
@ 2024-08-30 11:34 ` Mikael Sundqvist
2024-08-30 12:02 ` Shiv Shankar Dayal
0 siblings, 1 reply; 3+ messages in thread
From: Mikael Sundqvist @ 2024-08-30 11:34 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi,
try "dashed evenly" instead of just "dashed".
/Mikael (did not test...)
On Fri, Aug 30, 2024 at 1:24 PM Shiv Shankar Dayal
<shivshankar.dayal@gmail.com> wrote:
>
> Hi,
>
> I have plotted a log function and I want to draw an xy axis grid.
> Below is the code
>
> \starttext
> \startMPcode
> draw function(1,"x", "log(x)", .1, 10, .01) scaled 1cm;
> for i = 0 upto 10:
> draw (i*cm, -5cm) -- (i*cm, 5cm) dashed;
> endfor;
> for i = -5 upto 5:
> draw (0, i*cm) -- (10cm, i*cm) dashed;
> endfor;
> \stopMPcode
> \stoptext
>
> My first for loop draws lines but the second gives me an error. Please help.
> --
> Respect,
> Shiv Shankar Dayal
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* [NTG-context] Re: for loop not working in metapost
2024-08-30 11:34 ` [NTG-context] " Mikael Sundqvist
@ 2024-08-30 12:02 ` Shiv Shankar Dayal
0 siblings, 0 replies; 3+ messages in thread
From: Shiv Shankar Dayal @ 2024-08-30 12:02 UTC (permalink / raw)
To: mailing list for ConTeXt users
> try "dashed evenly" instead of just "dashed".
>
Thanks. It works nicely.
--
Respect,
Shiv Shankar Dayal
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-30 12:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-30 11:19 [NTG-context] for loop not working in metapost Shiv Shankar Dayal
2024-08-30 11:34 ` [NTG-context] " Mikael Sundqvist
2024-08-30 12:02 ` Shiv Shankar Dayal
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).