#12212: Colormap for implicit_plot3d and parametric_plot3d
-------------------------------------+-------------------------------------
       Reporter:  niles              |        Owner:  jason, was
           Type:  defect             |       Status:  needs_work
       Priority:  major              |    Milestone:  sage-6.3
      Component:  graphics           |   Resolution:
       Keywords:  colormap, plot     |    Merged in:
        Authors:  Joris              |    Reviewers:
  Vankerschaver, Frédéric Chapoton   |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:  u/chapoton/12212   |  eb4be95baaf9dc4baa3587cc2f9a4f6a8b8cdd02
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by chapoton):

 Thanks for your comments. I have adressed some of them

 > * I think there need to be some more doctests that verify the coloring
 of triangles is working.  At the moment, if some bug stopped colors from
 being applied to triangles, I think most of the doctests would still pass.
 Maybe at least you could add tests in `IndexFaceSet` for `tachyon_repr`,
 `obj`, and `x3d_geometry` similar to the one for `json_repr`.

 I have added a few doctests in index_face_set

 > * Was `IndexFaceSet.dual` broken before this patch?  Is there another
 ticket open for it?

 It is not really broken, just a bit fragile. I put a working doctest.

 > * The argument `texture_list` for `IndexFaceSet.__init__` displaces the
 argument `enclosed`, which technically means that the new behavior is not
 backwards-compatible.  I'm sorry to bring this up, because I think it's a
 really annoying detail, but I think Sage policy is that there should be a
 deprecation period in case someone somewhere is using `S =
 IndexFaceSet(face_list, point_list, False)`.  One thing would be to add a
 check `if type(texture_list) is bool:..." which issues a deprecation
 warning and fixes the arguments.  Or, maybe better, put the texture
 argument after the enclosure one, and always use it as a keyword.

 I have changed the order to keep "enclosed" before "texture_list"

 > * Since colormaps don't work with jmol, I think the demonstrations in
 parametric_plot3d and elsewhere should specifiy a viewer where they do
 work.  For example:
 >
 > {{{
 > sage: u,v = var('u,v')
 > sage: col = rainbow(10, 'rgbtuple')
 > sage: def cf(u,v): return sin(u^2 + v^2)**2
 > sage: parametric_plot3d((u, u+v, v), (u, -3,3), (v, -3, 3),
 colordata=(cf, colormaps.PiYG), viewer='tachyon')
 > }}}

 I have added lines with `P.show(viewer='tachyon')` where appropriate

 > * Why do this example and some others look so bad?  I think the first
 examples (the ones users are most likely to see) should be chosen to look
 really good.  If specifying a large number of plot points and marking
 #long or #optional is necessary, then I think that's better than fast but
 low-quality examples.  (Fast, low-quality examples are good for automatic
 testing, in parts of the documentation that new users are not likely to
 start with.)

 I have tried to enhance the quality of examples

 > * The syntax for colormaps of plotted functions (e.g. with `plot3d`) and
 parametric surfaces should be the same if at all possible.  Since `plot3d`
 calls `parametric_plot3d`, they should use the same code for colormaps.
 Also check `plot3d_adaptive` to see what it's doing.

 This is a difficult point. Achieving coeherence would be great, but I do
 not think that I am able to do that. For another ticket ?

 > * In `parametric_plot3d`, wouldn't it be more consistent to use
 `color_data` for the argument name, rather than `colordata`?  I know
 `colormap` is an established argument name (coming from matplot lib, I
 think), but I think it's better to use Sage's convention if possible.

 I have switched to color_data

 > * `ImplicitSurface` is derived from `IndexFaceSet`, so it should be
 reasonably straightforward to get colormaps for implicit plots working
 too.  Is there a good way to do it without just duplicating the code from
 `ParametricSurface`?  There seems to already be some duplicated code
 between them.  Maybe there needs to be some other kind of `PlotSurface`
 class that contains the common code?

 This is not as straightforward as it may look. It would be great to do
 that, but the code for implicit plot is very sophisticated, and it is not
 easy to see where to put the color assignment of faces.

 PLUS:

 I have reformatted texture_map so that the use of colormaps is simpler.

--
Ticket URL: <http://trac.sagemath.org/ticket/12212#comment:44>
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.

Reply via email to