Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add strands with different colors in BraidGroup plot #14533

Closed
mathzeta opened this issue May 5, 2013 · 14 comments
Closed

Add strands with different colors in BraidGroup plot #14533

mathzeta opened this issue May 5, 2013 · 14 comments

Comments

@mathzeta
Copy link

mathzeta commented May 5, 2013

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")

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()])

Apply:

Component: group theory

Keywords: braid group, plot

Author: Tomer Bauer

Reviewer: Frédéric Chapoton

Merged: sage-5.10.beta3

Issue created by migration from https://trac.sagemath.org/ticket/14533

@mathzeta
Copy link
Author

mathzeta commented May 5, 2013

Attachment: trac_14533_braid.patch.gz

Attachment: colored_braid.png

A braid with different colored strands

@mathzeta
Copy link
Author

mathzeta commented May 5, 2013

Attachment: red_braid.png

A braid with different colored red strands

@mathzeta

This comment has been minimized.

@fchapoton
Copy link
Contributor

Reviewer: Frédéric Chapoton

@fchapoton
Copy link
Contributor

comment:2

looks good to me. If you are happy with my review (add test and removes some unused imports) then you can set a positive review

@fchapoton
Copy link
Contributor

comment:3

Attachment: trac_14533_braid-review-fc.patch.gz

@fchapoton

This comment has been minimized.

@fchapoton

This comment has been minimized.

@mathzeta
Copy link
Author

mathzeta commented May 8, 2013

Attachment: trac_14533_braid2.patch.gz

@mathzeta

This comment has been minimized.

@mathzeta
Copy link
Author

mathzeta commented May 8, 2013

Author: Tomer Bauer

@mathzeta
Copy link
Author

mathzeta commented May 8, 2013

comment:6

Replying to @fchapoton:

looks good to me. If you are happy with my review (add test and removes some unused imports) then you can set a positive review

Thanks for your review. I had a trivial whitespace nitpick I added in attachment: trac_14533_braid2.patch. I think it's OK now.

This is new to me; Who should set the review status now?

@fchapoton
Copy link
Contributor

comment:7

well, there is no rule, as far as I know, but maybe not the author of the "latest patch"..

Anyway, looks good to me, positive review !

@jdemeyer
Copy link

Merged: sage-5.10.beta3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants