#4976: [with patch, needs review] fill option for plot, polar_plot and
parametric_plot
-------------------------+--------------------------------------------------
Reporter: whuss | Owner: whuss
Type: enhancement | Status: new
Priority: major | Milestone: sage-3.4.1
Component: graphics | Resolution:
Keywords: |
-------------------------+--------------------------------------------------
Comment (by jason):
First, I really appreciate this patch and the beautiful functionality it
adds. We've needed it for a long time. It also appears to do a much-
needed refactoring of the plot code. I haven't tested the patch, though,
or looked at it extremely closely.
Just a short comment about a piece of code. The patch uses map and
max/min to calculate filling to the max or min of the function. It would
be slightly faster and probably a lot clearer to just use list
comprehensions:
{{{
sage: data=[(x,x*x) for x in [0..10,step=0.01]]
sage: timeit('min(map(lambda t: t[1], data))')
625 loops, best of 3: 1.29 ms per loop
sage: timeit('min(i[1] for i in data)')
625 loops, best of 3: 1.15 ms per loop
}}}
It would be orders of magnitude faster to use numpy to store the list of
data. This would be a more major change in the plotting code, but here is
the equivalent numpy code:
{{{
sage: import numpy
sage: ndata=numpy.array(data,dtype=float)
sage: timeit('numpy.max(ndata[:,1])')
625 loops, best of 3: 30.7 µs per loop
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4976#comment:3>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---