Opened 10 years ago
Closed 10 years ago
#6615 closed defect (fixed)
Small bug in Graph.plot()
Reported by: | ncohen | Owned by: | rlm |
---|---|---|---|
Priority: | major | Milestone: | sage-4.3.1 |
Component: | graph theory | Keywords: | |
Cc: | Merged in: | sage-4.3.1.alpha2 | |
Authors: | Nathann Cohen | Reviewers: | Robert Miller |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
It may take only two lines, but I do not know which ones (I got a bit lost reading graph_plot.py) and it may take half a second to who wrote it in the first place.
g=graphs.PetersenGraph?()
g.plot(edge_colors={"red":[(0,1)]})
g.plot(vertex_colors={"red":[1]})
When you plot a graph and want some edges to have a different color, the first plot is perfect. In the second case, though, I think it would be better to assign the others vertices a default color ;-)
Attachments (1)
Change History (14)
comment:1 Changed 10 years ago by
- Description modified (diff)
comment:2 follow-up: ↓ 3 Changed 10 years ago by
comment:3 in reply to: ↑ 2 Changed 10 years ago by
- Summary changed from Small bug in Graph.plot() to [with patch, needs review] Small bug in Graph.plot()
All the vertices are colored even if vertex_colors did not contain colors for all of them. The first unused color in ranbow() is taken.
There was a small mistake in rgbcolor() where the hexcadecimal values were divided by 256 instead of 255 which lead to "red"!=(1,0,0).
All the colors were wrong and nobody noticed !! :-)
comment:4 Changed 10 years ago by
- Milestone set to sage-4.1.2
comment:5 Changed 10 years ago by
- Graphfunctions-1 has no reason for being here, but I can not delete it
- patchplot has been updated, I had forgotten to commit the change from 256 to 255 in rgbcolor()
comment:6 Changed 10 years ago by
- Summary changed from [with patch, needs review] Small bug in Graph.plot() to [with patch, needs work] Small bug in Graph.plot()
The edge color plot in the description works great.
The vertex color plot doesn't. The specified vertex is red; the others disappeared!
Also, it would be great to include those two examples in the docs.
comment:7 Changed 10 years ago by
Hello Jason !! I sent you an email about this patch some time ago, as I did not understand where this patch failed... Did you get it ? :-)
comment:8 Changed 10 years ago by
- Report Upstream set to N/A
- Reviewers set to Robert Miller
- Status changed from needs_work to needs_review
- Summary changed from [with patch, needs work] Small bug in Graph.plot() to Small bug in Graph.plot()
Patch works fine for me.
comment:9 Changed 10 years ago by
- Status changed from needs_review to positive_review
comment:10 Changed 10 years ago by
- Merged in set to sage-4.3.rc1
- Status changed from positive_review to needs_work
There are test failures in sage/plot/colors.py
comment:11 Changed 10 years ago by
- Status changed from needs_work to needs_review
comment:12 Changed 10 years ago by
- Status changed from needs_review to positive_review
comment:13 Changed 10 years ago by
- Merged in changed from sage-4.3.rc1 to sage-4.3.1.alpha2
- Resolution set to fixed
- Status changed from positive_review to closed
The best way to do that may be to let vertex_colors (resp. edge_colors) in Graph.plot() accept any partition of the vertices ( resp. edges ), and let it deal with rainbow to pick the colors. Obviously, it does not mean Graph.plot() should not also be able to support the current dictionary of (color, list)