#12212: Colormap for implicit_plot3d and parametric_plot3d
-------------------------------------+-------------------------------------
Reporter: niles | Owner: jason, was
Type: defect | Status: needs_work
Priority: major | Milestone: sage-6.4
Component: graphics | Resolution:
Keywords: colormap, plot | Merged in:
Authors: Joris | Reviewers: Frédéric Chapoton,
Vankerschaver, Frédéric Chapoton | Niles Johnson
Report Upstream: N/A | Work issues:
Branch: u/chapoton/12212 | Commit:
Dependencies: | 41fe504cbf6dc5244e22bfd6dd4b374fd7d1eb28
| Stopgaps:
-------------------------------------+-------------------------------------
Comment (by niles):
Oops, forgot the timing stuff.
First, general setup:
{{{
# setup
var('r v')
cmsel = [colormaps['autumn'](i) for i in sxrange(0,1,0.05)]
f(r,v) = 0.2*(r**2 + v**2) + cos(2*r)*sin(2*v)
from sage.plot.plot3d.texture_map import ColormapTransform
CMT = ColormapTransform(colormaps.autumn, 'height_z')
clebsch(x,y,z) =
81*(x^3+y^3+z^3)-189*(x^2*y+x^2*z+y^2*x+y^2*z+z^2*x+z^2*y)
+54*x*y*z+126*(x*y+x*z+y*z)-9*(x^2+y^2+z^2)-9*(x+y+z)+1
def R(x,y,z): return z
}}}
Now compare no colormap, colormap with plot3d_adaptive, the color_data
approach, and the `GradualTextureTransform` approach:
{{{
sage: # base
sage: %time q = plot3d(f,(r,-2,2), (v,-2,2))
CPU times: user 1.91 ms, sys: 75 µs, total: 1.98 ms
Wall time: 1.93 ms
sage: # with adaptive
sage: %time p = plot3d(f,(r,-2,2), (v,-2,2), adaptive=True, color=cmsel)
CPU times: user 29.2 ms, sys: 6.52 ms, total: 35.7 ms
Wall time: 31 ms
sage: # with color_data
sage: % time s = parametric_plot3d((r,v,f),(r,-2,2), (v,-2,2),
color_data=(cf,colormaps.PiYG))
CPU times: user 1.89 ms, sys: 74 µs, total: 1.96 ms
Wall time: 1.92 ms
sage: # with GTT
sage: %time t = CMT.apply(parametric_plot3d((r,v,f),(r,-2,2), (v,-2,2)))
CPU times: user 4.55 ms, sys: 911 µs, total: 5.46 ms
Wall time: 4.84 ms
sage: %time t = CMT.apply(s)
CPU times: user 2.29 ms, sys: 724 µs, total: 3.01 ms
Wall time: 2.67 ms
}}}
An example that takes longer to plot, to see how adding colormap affects
the time:
{{{
sage: %time k = implicit_plot3d(clebsch, (x,-2,2), (y,-2,2), (z,-2,2))
CPU times: user 6.71 ms, sys: 292 µs, total: 7 ms
Wall time: 6.88 ms
sage: %time m = implicit_plot3d(clebsch, (x,-2,2), (y,-2,2), (z,-2,2),
color_data=(R,cm))
CPU times: user 7.89 ms, sys: 371 µs, total: 8.26 ms
Wall time: 7.98 ms
sage: %time j = CMT.apply(k)
CPU times: user 12.5 ms, sys: 2.86 ms, total: 15.3 ms
Wall time: 13.2 ms
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/12212#comment:78>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.