function plotting (was: Re: [NTG-context] Q: about \externalfile from metafun-p.pdf)
On Mon 03.10.2005 19:26, Christopher Creutzig wrote: MetaPost is not really a function plotter. So, yes, you have to use some sort of loop, although there may be some predefined macros hiding them. Is there a better way in ConTeXt/tex for this?! Should i use some external Programms for this? al ;-) ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: function plotting (was: Re: [NTG-context] Q: about \externalfile from metafun-p.pdf)
Alexander Lazic wrote: On Mon 03.10.2005 19:26, Christopher Creutzig wrote: MetaPost is not really a function plotter. So, yes, you have to use some sort of loop, although there may be some predefined macros hiding them. Is there a better way in ConTeXt/tex for this?! Should i use some external Programms for this? al ;-) I use gnuplot which makes graphs of superb visual quality and has extensive support for many different function manipulations and weird stuff that you want to do with it. I do something like: set terminal latex set output file.tex set title '\bf My wonderful function $sin(\omega t)$' set xlabel '$t\ \rm[s]$' set ylabel '$A$' plot sin(x) and then \input file inside of the main LaTeX file. Gnuplot cannot make output in ConTeXt (yet), but perhaps you can include the resulting PDFs in your ConTeXt source. (Gnuplot is one of the very few examples where I still use LaTeX.) You can also output the (ConTeXt-friendly) metapost (with set terminal), but you lose on quality. Mojca ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: function plotting (was: Re: [NTG-context] Q: about \externalfile from metafun-p.pdf)
On Die 04.10.2005 19:48, Mojca Miklavec wrote: I use gnuplot which makes graphs of superb visual quality and has extensive support for many different function manipulations and weird stuff that you want to do with it. I have also think on gnuplot, but wasn't sure that i can use the ps/pdf into my context doc. and then \input file inside of the main LaTeX file. Gnuplot cannot make output in ConTeXt (yet), but perhaps you can include the resulting PDFs in your ConTeXt source. (Gnuplot is one of the very few examples where I still use LaTeX.) You can also output the (ConTeXt-friendly) metapost (with set terminal), but you lose on quality. Well i will also try with gnuplot. How much bad is 'lose quality' in %? greetings al ;-) ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Q: about \externalfile from metafun-p.pdf
On Son 02.10.2005 22:36, Christopher Creutzig wrote: Alexander Lazic wrote: 2.) i have try \startreusableMPgraphic{sin} sin (1); \stopreusableMPgraphic{sin} This {sin} at the end is wrong; it's interpreted as text. This have i understand ;-) I called it sin, sorry for confusion. What you can do is something like drawdot(10*x, 10*sin(x)) withpen pencircle scaled 1pt; Thanx. Have i right understand, if i want to draw a sinuscurve i must use a for-loop? I think it really helps with MP programming to understand this type of loops. Well i think i must learn mp before context, if i want to draw some mathemathics functions ;-) Thanx again for help. greetings al ;-) ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Q: about \externalfile from metafun-p.pdf
Alexander Lazic wrote: \stopreusableMPgraphic{sin} This {sin} at the end is wrong; it's interpreted as text. This have i understand ;-) I called it sin, sorry for confusion. The name is unimportant – my point is that the \stop... commands don't get arguments. Thanx. Have i right understand, if i want to draw a sinuscurve i must use a for-loop? MetaPost is not really a function plotter. So, yes, you have to use some sort of loop, although there may be some predefined macros hiding them. Christopher ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Q: about \externalfile from metafun-p.pdf
Alexander Lazic wrote: i'm starting to learn context and therefore i have copied some examples from metafun-p.pdf and get the following error: --- ! Undefined control sequence. l.42 \externalfile [mprun.21][width=5cm] Probably a typo in metafun-p.pdf; try \externalfigure instead. Christopher ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Q: about \externalfile from metafun-p.pdf
On Son 02.10.2005 19:54, Christopher Creutzig wrote: Probably a typo in metafun-p.pdf; try \externalfigure instead. Thanx this works ;-) Oh btw: i have see in the syntax-diagramm sin. 1.) is this the sinus function? 2.) i have try --- \startreusableMPgraphic{sin} sin (1); \stopreusableMPgraphic{sin} \reuseMPgraphic{sin} --- and get: Isolated expression. Do you know what's going wrong? al ;-) ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Q: about \externalfile from metafun-p.pdf
Alexander Lazic wrote: Oh btw: i have see in the syntax-diagramm sin. 1.) is this the sinus function? Sure. (The sine function as used by mathematicians. If you want the sine of an angle expressed in degrees, I believe you want sind.) 2.) i have try --- \startreusableMPgraphic{sin} sin (1); \stopreusableMPgraphic{sin} This {sin} at the end is wrong; it's interpreted as text. \reuseMPgraphic{sin} --- and get: Isolated expression. Do you know what's going wrong? It's the same error as trying to “plot” the MP code 1; MetaPost is confused since it has no idea what to do with that number and tells you so. Since MP can handle more than just numbers, you get a slightly more general error message that talks about an “expression” rather than a “number.” What you can do is something like \starttext \startusableMPgraphic{sin} for x := 0 step 0.6282 until 6.282: drawdot(10*x, 10*sin(x)) withpen pencircle scaled 1pt; endfor \stopusableMPgraphic \useMPgraphic{sin} \stoptext Or, you can use the fact that in MetaPost you can build up an expression within a for loop as follows: \starttext \startusableMPgraphic{sin} draw (0,0) for x := 0 step 0.2 until 6.282: ..(10*x, 10*sin(x)) endfor; \stopusableMPgraphic \useMPgraphic{sin} \stoptext I think it really helps with MP programming to understand this type of loops. Christopher ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context