On Fri, Nov 11, 2011 at 4:25 PM, krastanov.ste...@gmail.com <krastanov.ste...@gmail.com> wrote: > > > On 11 November 2011 23:31, Aaron Meurer <asmeu...@gmail.com> wrote: >> >> On Fri, Nov 11, 2011 at 2:13 PM, krastanov.ste...@gmail.com >> <krastanov.ste...@gmail.com> wrote: >> > Hi >> > >> > I'm a bit ashamed that Aaron gave better introduction than me for my own >> > code :) >> > Anyway, I think the documentation of Plot and the module is quite >> > detailed >> > so you can look also at help(Plot) anhelp(newplot). >> > >> > About the warnings - my idea was to structure the base backend class in >> > such >> > a way that any missing functionality in the backend subclass will just >> > raise >> > a warning but not an error (unless it is some essential functionality). >> > So >> > those will be addressed later. >> > >> > It can plot Integrals (due to an old addition done to lambdify thanks to >> > Certik) but not Sums or anything fancy like product of Kets and Bras. To >> > do >> > those a more in depth refactoring of lambda will be needed as Certik's >> > method for adding Integral to lambdify does not scale well. I think this >> > is >> > an important problem. >> >> I agree. Is there an issue for this? > > No issue for the moment. I take responsibility for creating one when I > gather enough understanding of the code and the problem. >> >> > >> > Discontinuous functions may pose problems for the moment (none seen for >> > the >> > moment, but this is mostly by chance). >> >> As far as I can tell, this is a nontrivial problem to solve, as many >> very good plotting systems choke on discontinuous functions. Perhaps >> there can be some kind of symbolic heuristic applied to find >> discontinuities. > > I think Maple has some option in its plotting module about detecting > asymptotes (numerically?) but I can not check it at the moment. Anyhow, this > is not the most important feature at the moment. >> >> > >> > About the bug in matplotlib - Aaron, you said that you will make a pull >> > request for them. Should I do something or you have already taken care >> > of >> > this. >> >> Sorry for the misunderstanding, but this is not what I said. I was >> suggesting to you that you do it. I haven't even been able to >> reproduce the bug you are seeing, so I can't even tell with certainty >> what the correct fix is. > > I'm sorry :D (my mistake). I'll do it. >> >> > >> > I'll start writing tests for the module in the near future. Then the >> > core >> > devs should tell me if this code is going in and how. >> >> I definitely think it should go in. I guess the question is how to >> properly replace/merge it with the old module, which isn't compatible >> (it uses different syntax, keywords, etc.) >> >> Actually, to what degree is the new Plot() function incompatible with >> the old one? Would it be possible to merge the two without breaking >> compatibility with the old module? > > There are some things about the api of the old module that I don't like, but > I'll check if there is a compromise that can be made. I understand the > importance of not breaking the api.
What are these specifically. Is it possible to support both APIs at the same time, while deprecating the old one, r would they have to be completely different functions to prevent ambiguous input? Also, even if you don't plan to have this ready by the next release, we can start deprecating the old module now. The differences that I've noticed are that with the new module, you have to specify a variable and range (but assumedly, this will be relaxed at some point?), and that you have to call p.show() to actually see the plot. One idea regarding the last point would be to create a function plot() (lowercase) which automatically shows the plot, which would be used for quick plotting, and then leave Plot() for more advanced plots. Aaron Meurer > > But I was thinking it would be best to have both modules and then a backend > for the old module in the new module. And maybe move the old module to > plotting.oldplot or leave the new module in plotting.newplot. >> >> > >> > About the '3d' string - you are right it's a bad default. It's just that >> > contour was written first, but I'll change this now. >> >> Cool. By the way, will it be possible in the future to call something >> like p.change_plot_type('contour') (only with a better name than that >> :) and it will change it from 3d to a contour? > > At the moment 3dsurface (not parametric) and contour are represented by > different classes. It makes sense to merge them and add an option (actually > there is a repetition of code at the moment). It would be something like: > p = Plot(blah blah) > p[0].visualisation_method = '3d' or 'contour' > the name of the attribute may be other ('plot_type', 'projection', ...) >> >> > >> > Finally - I was squashing and rebasing this pull request quite a bit. >> > Now as >> > it's getting more attention I'll stop doing it, so you are free to make >> > changes if you are interested. >> >> Great. This makes it easier to follow your progress. >> >> Aaron Meurer >> >> > >> > On 11 November 2011 21:41, Aaron Meurer <asmeu...@gmail.com> wrote: >> >> >> >> Oh, I forgot to mention that I got the following warnings: >> >> >> >> In [6]: p = Plot(Heaviside(x)*(1 - x)*sin(y), (x, -1, 1), (y, -pi, pi)) >> >> >> >> In [7]: p.show() >> >> /sw/lib/python2.7/site-packages/matplotlib/axes.py:4368: UserWarning: >> >> No labeled objects found. Use label='...' kwarg on individual plots. >> >> warnings.warn("No labeled objects found. " >> >> >> >> In [8]: p = Plot(Heaviside(x)*(1 - x)*sin(y), (x, -1, 1), (y, -pi, pi), >> >> '3d') >> >> >> >> In [9]: p.show() >> >> >> >> >> >> /Users/aaronmeurer/Documents/python/sympy/sympy/sympy/plotting/newplot.py:901: >> >> UserWarning: xscale is not supported in 3D matplotlib backend. >> >> warnings.warn('xscale is not supported in 3D matplotlib backend.') >> >> >> >> >> >> /Users/aaronmeurer/Documents/python/sympy/sympy/sympy/plotting/newplot.py:879: >> >> UserWarning: axis_center is not supported in 3D matplotlib backend. >> >> warnings.warn('axis_center is not supported in 3D matplotlib >> >> backend.') >> >> >> >> >> >> /Users/aaronmeurer/Documents/python/sympy/sympy/sympy/plotting/newplot.py:895: >> >> UserWarning: xscale is not supported in 3D matplotlib backend. >> >> warnings.warn('xscale is not supported in 3D matplotlib backend.') >> >> >> >> Aaron Meurer >> >> >> >> On Fri, Nov 11, 2011 at 1:39 PM, Aaron Meurer <asmeu...@gmail.com> >> >> wrote: >> >> > Hi. >> >> > >> >> > This looks great. For others, to run the examples, download the >> >> > examples script and put in the sympy directory. Then, checkout >> >> > Krastanov's branch (from the pull request). Then, run IPython, and >> >> > type %run examples.py. And then type p0.show(), p1.show(), etc. (up >> >> > to p4). >> >> > >> >> > And if you just want to test the plotting of your own functions in >> >> > isympy, you have to run "from sympy.plotting.newplot import *", or >> >> > else it will use the old plotting. The syntax is >> >> > >> >> > In [8]: p = Plot(Heaviside(x)*(1 - x)*sin(y), (x, -1, 1), (y, -pi, >> >> > pi), >> >> > '3d') >> >> > >> >> > In [9]: p.show() >> >> > >> >> > (if you don't add '3d' in this case, it will default to a contour >> >> > plot, which btw is maybe not the best default) >> >> > >> >> > Aaron Meurer >> >> > >> >> > On Fri, Nov 11, 2011 at 7:46 AM, krastanov.ste...@gmail.com >> >> > <krastanov.ste...@gmail.com> wrote: >> >> >> The proposal that I made in https://github.com/sympy/sympy/pull/673 >> >> >> may >> >> >> or >> >> >> may not became part of sympy but I like it and it's already quite >> >> >> useful for >> >> >> me. >> >> >> >> >> >> Here are some examples. I would like to know what do you think. The >> >> >> 3d >> >> >> stuff >> >> >> runs only on the latest version of matplotlib _after_ fixing a bug >> >> >> (mentioned in the commit history, but those will be squashed soon). >> >> > >> >> > I didn't have any problems with it, though you do seem to have found >> >> > a >> >> > bug in matplotlib. I would submit a pull request to them fixing it. >> >> > >> >> > Aaron Meurer >> >> > >> >> >> >> >> >> The script to produce them is also attached (as the api is probably >> >> >> more >> >> >> important than the visuals (the _series[index] stuff is just a >> >> >> workaround >> >> >> until getters are written)). >> >> >> >> >> >> Regards >> >> >> Stefan >> >> >> >> >> >> -- >> >> >> You received this message because you are subscribed to the Google >> >> >> Groups >> >> >> "sympy" group. >> >> >> To post to this group, send email to sympy@googlegroups.com. >> >> >> To unsubscribe from this group, send email to >> >> >> sympy+unsubscr...@googlegroups.com. >> >> >> For more options, visit this group at >> >> >> http://groups.google.com/group/sympy?hl=en. >> >> >> >> >> > >> >> >> >> -- >> >> You received this message because you are subscribed to the Google >> >> Groups >> >> "sympy" group. >> >> To post to this group, send email to sympy@googlegroups.com. >> >> To unsubscribe from this group, send email to >> >> sympy+unsubscr...@googlegroups.com. >> >> For more options, visit this group at >> >> http://groups.google.com/group/sympy?hl=en. >> >> >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "sympy" group. >> > To post to this group, send email to sympy@googlegroups.com. >> > To unsubscribe from this group, send email to >> > sympy+unsubscr...@googlegroups.com. >> > For more options, visit this group at >> > http://groups.google.com/group/sympy?hl=en. >> > >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sympy" group. >> To post to this group, send email to sympy@googlegroups.com. >> To unsubscribe from this group, send email to >> sympy+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/sympy?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To post to this group, send email to sympy@googlegroups.com. > To unsubscribe from this group, send email to > sympy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sympy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.