Opened 8 years ago
Closed 8 years ago
#14533 closed enhancement (fixed)
Add strands with different colors in BraidGroup plot
Reported by: | mathzeta2 | Owned by: | joyner |
---|---|---|---|
Priority: | minor | Milestone: | sage-5.10 |
Component: | group theory | Keywords: | braid group, plot |
Cc: | Merged in: | sage-5.10.beta3 | |
Authors: | Tomer Bauer | Reviewers: | Frédéric Chapoton |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
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 idiomisinstance(color, (list, tuple))
which is of prevalent use in Sage. Should we useisinstance(color, collections.Sequence)
instead, with the downside that we need to checkisinstance(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:
Attachments (5)
Change History (13)
Changed 8 years ago by
Changed 8 years ago by
comment:1 Changed 8 years ago by
- Description modified (diff)
comment:2 follow-up: ↓ 6 Changed 8 years ago by
- Reviewers set to Frédéric Chapoton
- Status changed from new to needs_review
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
Changed 8 years ago by
comment:3 Changed 8 years ago by
- Description modified (diff)
comment:4 Changed 8 years ago by
- Description modified (diff)
Changed 8 years ago by
comment:5 Changed 8 years ago by
- Description modified (diff)
comment:6 in reply to: ↑ 2 Changed 8 years ago by
Replying to chapoton:
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 trac_14533_braid2.patch. I think it's OK now.
This is new to me; Who should set the review status now?
comment:7 Changed 8 years ago by
- Status changed from needs_review to positive_review
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 !
comment:8 Changed 8 years ago by
- Merged in set to sage-5.10.beta3
- Resolution set to fixed
- Status changed from positive_review to closed
A braid with different colored strands