Ticket #3843 (closed defect: fixed)

Opened 19 months ago

Last modified 19 months ago

[with patch, positive review] nice tree plotting - improve graph plotting docs

Reported by: was Owned by: rlm
Priority: major Milestone: sage-3.1.2
Component: graph theory Keywords:
Cc: Author(s):
Report Upstream: Reviewer(s):
Merged in: Work issues:

Description (last modified by rlm) (diff)

: "edge_labels -- whether to print edgeedge labels. By default, False, but"

Notice the edgeedge.

was: Also a complaint - I tried for 15 minutes and couldn't figure out how to label the edges!

Anyway, the docs need a few extra examples, so I'll post a patch soon.

Attachments

trac_3843-come_on.patch Download (2.2 KB) - added by rlm 19 months ago.
trac_3843-plot-trees.patch Download (5.7 KB) - added by rlm 19 months ago.
trac_3843-docs.patch Download (5.5 KB) - added by rlm 19 months ago.
trac_3843-reviewer-suggestions.patch Download (2.9 KB) - added by saliola 19 months ago.
diff file with my suggested changes
trac_3843-plot-options.patch Download (2.0 KB) - added by rlm 19 months ago.
trac_3843-flat-and-fixed.2.patch Download (12.7 KB) - added by rlm 19 months ago.

Change History

Changed 19 months ago by rlm

sage: G = graphs.PetersenGraph()
sage: G.set_edge_label(0,1,'spam')
sage: G.plot(edge_labels=True)

I don't see how to make it easier to figure out...

Changed 19 months ago by rlm

Changed 19 months ago by rlm

  • description modified (diff)
  • summary changed from typo in graphs: "edge_labels -- whether to print edgeedge labels. By default, False, but" to improve graph plotting docs

Changed 19 months ago by rlm

Changed 19 months ago by rlm

Depends on patches at #3801.

One note- many doctests are deleted in this patch, since I have probably spent a sum of about five days cutting and pasting the same tests from plot to show or vice versa. Now there is one simple test in show and it suggests to look at plot for good documentation.

Changed 19 months ago by ekirkman

  • summary changed from improve graph plotting docs to nice tree plotting - improve graph plotting docs

Changed 19 months ago by rlm

Changed 19 months ago by ekirkman

  • summary changed from nice tree plotting - improve graph plotting docs to [with patch, positive review] nice tree plotting - improve graph plotting docs

Changed 19 months ago by saliola

One suggested change (I'll attach a diff file):

tree_root takes a tuple as an argument (v, str), where v is a vertex and str is either "top" or "bottom". This isn't intuitive: I first tried a vertex only, which forced me to look at the documentation to understand why I got an unpacking error message.

I suggest splitting this option into two: tree_root (takes a vertex) and tree_orientation (takes "up" or "down").

Changed 19 months ago by saliola

diff file with my suggested changes

Changed 19 months ago by rlm

+1 to saliola's patch. I haven't tested it, but I completely agree with the idea.

Changed 19 months ago by rlm

  • summary changed from [with patch, positive review] nice tree plotting - improve graph plotting docs to [with patch, positive review pending] nice tree plotting - improve graph plotting docs

There is a little more work needing to be done here. I ignored William when he was trying to tell me that the tree options aren't available to G.show(). In fact, I'm going to rewrite both plot and show's argument handling to use keywords instead. This will improve usability and code.

Sorry, was. You were right. :-)

Changed 19 months ago by rlm

Changed 19 months ago by rlm

  • summary changed from [with patch, positive review pending] nice tree plotting - improve graph plotting docs to [with patch, positive review, last patch still needs review] nice tree plotting - improve graph plotting docs

Changed 19 months ago by mabshoff

  • summary changed from [with patch, positive review, last patch still needs review] nice tree plotting - improve graph plotting docs to [with patch, needs work] nice tree plotting - improve graph plotting docs

Against my current 3.1.2.alpha1 merge tree there is one doctest failure with all five patches applied:

sage -t -long devel/sage/sage/graphs/graph.py               
**********************************************************************
File "/scratch/mabshoff/release-cycle/sage-3.1.2.alpha1/tmp/graph.py", line 7632:
    sage: ((graphs.ChvatalGraph()).cliques_get_clique_bipartite()).show(figsize=[2,2], vertex_size=20, vertex_labels=False)
Exception raised:
    Traceback (most recent call last):
      File "/scratch/mabshoff/release-cycle/sage-3.1.2.alpha1/local/lib/python2.5/doctest.py", line 1228, in __run
        compileflags, 1) in test.globs
      File "<doctest __main__.example_161[3]>", line 1, in <module>
        ((graphs.ChvatalGraph()).cliques_get_clique_bipartite()).show(figsize=[Integer(2),Integer(2)], vertex_size=Integer(20), vertex_labels=False)###line 7632:
    sage: ((graphs.ChvatalGraph()).cliques_get_clique_bipartite()).show(figsize=[2,2], vertex_size=20, vertex_labels=False)
      File "/scratch/mabshoff/release-cycle/sage-3.1.2.alpha1/local/lib/python2.5/site-packages/sage/graphs/graph.py", line 5439, in show
        self.plot(**plot_kwds).show(**kwds)
    TypeError: show() got an unexpected keyword argument 'vertex_size'
**********************************************************************

Changed 19 months ago by rlm

  • summary changed from [with patch, needs work] nice tree plotting - improve graph plotting docs to [with patch, needs final review] nice tree plotting - improve graph plotting docs

With the new flat patch:

rank4:sage-3843 rlmill$ ../../sage -tp 2 -long sage/graphs
...
All tests passed!
Total time for all tests: 300.7 seconds

Changed 19 months ago by rlm

Changed 19 months ago by mabshoff

  • summary changed from [with patch, needs final review] nice tree plotting - improve graph plotting docs to [with patch, positive review] nice tree plotting - improve graph plotting docs

Positive review. rlm explained the last fix to me and I am satisfied.

Cheers,

Michael

Changed 19 months ago by mabshoff

  • status changed from new to closed
  • resolution set to fixed

Merged trac_3843-flat-and-fixed.2.patch in Sage 3.1.2.alpha3

Note: See TracTickets for help on using tickets.