Re: [NTG-context] OT: drawing graphs: Asymptote, Gnuplot, MetaFun, …

2011-04-20 Thread Aditya Mahajan

On Mon, 18 Apr 2011, Paul Menzel wrote:


The only downside of Asymptote I found so far is, that there is no
mailing list.


Asymptote has fairly active forums on sourceforge 
http://sourceforge.net/projects/asymptote/forums/forum/409349
and at art of problem solving 
http://www.artofproblemsolving.com/Forum/viewforum.php?f=519


Aditya
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] OT: drawing graphs: Asymptote, Gnuplot, MetaFun, …

2011-04-18 Thread Paul Menzel
Dear ConTeXt folks,


I need to plot some random walks similar to [1], but for example I need
to emphasize certain sections of the plot and put labels and notes in
there.

Could you recommend a tool to easily accomplish that goal with easily. I
guess it can be done with any of those as seen by the demos [2][3].

I only have little experience using Gnuplot and I have never used
Asymptote or MetaFun. These three seem to be well integrated with
ConTeXt and I guess in the end I could just create the image files and
include these in to my ConTeXt source.

The only downside of Asymptote I found so far is, that there is no
mailing list.


Thanks in advance,

Paul


[1] https://secure.wikimedia.org/wikipedia/en/wiki/File:Random_Walk_example.svg
[2] http://asymptote.sourceforge.net/gallery/2D graphs/index.html
[3] http://gnuplot.info/screenshots/index.html#demos


signature.asc
Description: This is a digitally signed message part
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] OT: drawing graphs: Asymptote, Gnuplot, MetaFun, …

2011-04-18 Thread Pontus Lurcock
On Mon 18 Apr 2011, Paul Menzel wrote:

 I only have little experience using Gnuplot and I have never used
 Asymptote or MetaFun. These three seem to be well integrated with
 ConTeXt and I guess in the end I could just create the image files
 and include these in to my ConTeXt source.

If you don't mind using external figures, I personally would recommend
matplotlib (as used to create the example you linked to) -- in which
case you already have an example script for your graph :-). The
annotation and labelling facilities are extensive (see
http://matplotlib.sourceforge.net/examples/pylab_examples/annotation_demo2.html
) and there is ample documentation. I used to be a happy Gnuplot user,
but I find that with matplotlib the easy things are just as easy, the
hard things are easier, and some of the impossible things become
possible.

I did give MetaFun a try before turning to matplotlib, but I found it
quite difficult to work with. That's strictly related to my personal
requirements and taste though -- there are many satisfied MetaFun
users on this list (and thus good support) and of course it is very
well integrated with ConTeXt.

Asymptote looks nice but I've never tried it. I think there have been
some issues with ConTeXt integration in the past (see
http://thread.gmane.org/gmane.comp.tex.context/54389 ) but am unsure
of the current state.

Hope this helps,

Pont
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] OT: drawing graphs: Asymptote, Gnuplot, MetaFun, …

2011-04-18 Thread Mojca Miklavec
On Mon, Apr 18, 2011 at 22:20, Paul Menzel wrote:
 Dear ConTeXt folks,

 I need to plot some random walks similar to [1], but for example I need
 to emphasize certain sections of the plot and put labels and notes in
 there.

 Could you recommend a tool to easily accomplish that goal with easily. I
 guess it can be done with any of those as seen by the demos [2][3].

 I only have little experience using Gnuplot and I have never used
 Asymptote or MetaFun. These three seem to be well integrated with
 ConTeXt and I guess in the end I could just create the image files and
 include these in to my ConTeXt source.

 The only downside of Asymptote I found so far is, that there is no
 mailing list.

Below you have an example done in metapost/metafun (which integrates
well with ConTeXt). The downside of metapost is that you have to do
all the labels and axis drawing more or less manually, while gnuplot
will take care of drawing axes and properly adjusting the range etc.
On the other hand metapost might be quite powerful for geometrically
complex graphics.

If you use gnuplot, you might need to precompute the points for the
random walk (it supports random numbers, but I'm not sure if you can
calculate sums), while metapost can do some reasonable calculations on
the fly.

For 2D graphics asymptote doesn't bring you much.

Yet another alternative is TikZ and pgfplots (similar to metapost,
more library functions ready to draw all kinds of graphics, but less
powerful math engine that in metapost).

\setupcolors
[state=start]
\starttext
\startMPpage

save wx, wy;

wx = 15cm;
wy = 10cm;

draw unitsquare shifted (0,-0.5) xyscaled (wx,wy);

save val; numeric val;
save tmp; numeric tmp;
save p;   path p;
save c;   color c[];

c[1] = red;
c[2] = .5[red,yellow];
c[3] = .6green;
c[4] = blue;
c[5] = .4white;


vardef newval =
val := val + floor(uniformdeviate(2))*2-1;
(val)
enddef;

for n=1 upto 5:
val := 0; draw (0,0)
for i=0 upto 100:
-- (0.01*i*wx,0.025*newval*wy)
endfor
withcolor c[n];
endfor


for i=0 step 20 until 100:
label.bot(decimal(i), (0.01*i*wx,-.5*wy));
endfor;
for i=-20 step 5 until 20:
label.lft(decimal(i), (0,0.025*i*wy));
endfor;

\stopMPpage
\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___