for loop not working in metapost
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
Hi,
try "dashed evenly" instead of just "dashed".
/Mikael (did not test...)
On Fri, Aug 30, 2024 at 1:24 PM Shiv Shankar Dayal
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 ___________________________________________________________________________________
participants (2)
-
Mikael Sundqvist
-
Shiv Shankar Dayal