#14533: Add strands with different colors in BraidGroup plot
-------------------------------------+--------------------------------------
       Reporter:  mathzeta2          |         Owner:  joyner   
           Type:  enhancement        |        Status:  new      
       Priority:  minor              |     Milestone:  sage-5.10
      Component:  group theory       |    Resolution:           
       Keywords:  braid group, plot  |   Work issues:           
Report Upstream:  N/A                |     Reviewers:           
        Authors:                     |     Merged in:           
   Dependencies:                     |      Stopgaps:           
-------------------------------------+--------------------------------------
Description changed by mathzeta2:

Old description:

> Currently, when plotting a braid, all the strands are in the same color.
> For `plot3d()`, even choosing a different color is unavailable.
>
> The attached patch adds the ability to give each strand a different
> color. This is done for `plot()` and `plot3d()`.
>
> Few notes:
> * I changed the default coloring scheme, so instead of blue strands, the
> braids are in different colors.
> * The color option can be one of: single color, which is backwards-
> compatible; "rainbow", the default; A list or a tuple of colors.
> * Some of the plot options are "global" for the entire plot (e.g. aspect
> ratio and axes), but some should be "local" for a specific strand (e.g.
> color, thickness or alpha). Maybe there should be another ticket for
> this, as I just needed different colored strands.
> * When testing if the `color` is a list or a tuple I used the idiom
> `isinstance(color, (list, tuple))` which is of prevalent use in Sage.
> Should we use `isinstance(color, collections.Sequence)` instead, with the
> downside that we need to check `isinstance(color, types.StringTypes)`
> first?
>
> Two examples:
> {{{
> B6.<a,b,c,d,e> = BraidGroup(6)
> z = a^-1*b*c^3*e^-2*a*b^2*a^-3*d^5*c*a*b*c*d*e^2*d^-1*c^-1*b^-1*a^-1
> bp1 = z.plot(orientation="left-right")
> }}}
> [[Image()]]
> {{{
> from sage.plot import colors
> B3.<f,g> = BraidGroup(3)
> z2 = g^-1*f^2
> bp2 = z2.plot(orientation="top-bottom",
>             thickness=4,
>             color=[colors.red.lighter(), colors.red,
> colors.red.darker()])
> }}}
> [[Image()]]

New description:

 Currently, when plotting a braid, all the strands are in the same color.
 For `plot3d()`, even choosing a different color is unavailable.

 The attached patch adds the ability to give each strand a different color.
 This is done for `plot()` and `plot3d()`.

 Few notes:
 * I changed the default coloring scheme, so instead of blue strands, the
 braids are in different colors.
 * The color option can be one of: single color, which is backwards-
 compatible; "rainbow", the default; A list or a tuple of colors.
 * Some of the plot options are "global" for the entire plot (e.g. aspect
 ratio and axes), but some should be "local" for a specific strand (e.g.
 color, thickness or alpha). Maybe there should be another ticket for this,
 as I just needed different colored strands.
 * When testing if the `color` is a list or a tuple I used the idiom
 `isinstance(color, (list, tuple))` which is of prevalent use in Sage.
 Should we use `isinstance(color, collections.Sequence)` instead, with the
 downside that we need to check `isinstance(color, types.StringTypes)`
 first?

 Two examples:
 {{{
 B6.<a,b,c,d,e> = BraidGroup(6)
 z = a^-1*b*c^3*e^-2*a*b^2*a^-3*d^5*c*a*b*c*d*e^2*d^-1*c^-1*b^-1*a^-1
 bp1 = z.plot(orientation="left-right")
 }}}
 [[Image(ticket:14533:colored_braid.png)]]
 {{{
 from sage.plot import colors
 B3.<f,g> = BraidGroup(3)
 z2 = g^-1*f^2
 bp2 = z2.plot(orientation="top-bottom",
             thickness=4,
             color=[colors.red.lighter(), colors.red, colors.red.darker()])
 }}}
 [[Image(ticket:14533:red_braid.png)]]

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14533#comment:1>
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to