From: Armin S. <li...@ar...> - 2005-09-09 17:59:23
|
Hello J=F6rg, > > Today I have uploaded a first version of Simply Draw to my homepage [2] > > and included some examples [3] to show how easy it can be to generate > > graphics using PyX. > > Unfortunately, I was not able to access all the examples - somehow I > always end up at the "clip" page. I have tried it from here, but I was unable to reproduce this bug. What doe= s=20 happen if you request the url [1]? Do you still get the (default) Clipping= =20 example displayed? This really puzzles me... is anyone seeing a similar misbehaviour? [1]=20 http://arminstraub.de/browse.php?page=3Dprograms_simplydraw_samples&sample= =3Dstackinggraphs > > The module pyxmath.py included in Simply Draw contains additional > > functionality for PyX (two graph data sources and a graph style). Perha= ps > > you may want to think about including similar functionality to PyX > > itself. > > Concering the Python function stuff, I'm not sure whether this will be > needed in PyX 0.9 anymore (but it could still be useful). The reason for > this being that we removed our own expressions parser in favour of using > the Python eval function. Commenting on the graph style, I'll happily > leave to Andr=E9... I was aware of the removal of the expression parser. But still a string is= =20 used to carry the expression. This might be nice for simple expression as=20 "x**2", but unfortunately it is not usable in the general case. I was e.g. = to=20 plot typical graphs of a fractional Brownian motion (you can see the source= =20 at [1] if you are more lucky this time). The trajectories to plot are not=20 given by an expression that could be passed in a string. Nonetheless it is= =20 easy to define a Python function that represents this trajectory. This is were functionxy comes into play. Instead of taking a string that ho= lds=20 a Pythonic expression it just takes a real expression. At least this is what I thought when writing these data sources (where=20 mathtree was still in use). But you make me wonder if these are still usefu= l=20 in PyX 0.9 then. If I define a function say def h(x): ... can I then use something like function("y=3Dh(x)") in PyX (sorry if the syntax is wrong, but I hope you get what I mean)? If t= his=20 is possible then my derivation is technically useless. On the other hand I= =20 think it would be nice if one could write as well function(h) with the same result. Shouldn't this be possible by a simple check to see i= f=20 expr passed to function is callable? I think this would be more clean in th= is=20 case and eliminates the need to parse the string and call eval. I even think that it is more straightforward to write function(lambda x: x**2) instead of something like function("f(x)=3Dx**2") but I think that's personal taste and sometimes it may be more convenient t= o=20 pass a string. That said, I think I will remove functionxy() in favour of function() takin= g=20 either a string or an expression. Do you think something like that would be= =20 useful also to have in PyX 0.9? It would not break the traditional behaviou= r=20 and provide new possibilities. Thanks for your comments. Cheers =2D-=20 Armin Straub |