# HG changeset patch
# User Nathann Cohen <nathann.cohen@gmail.com>
# Date 1359570405 3600
# Node ID 6254cd0f49d862ce94bb138b7e2ff81992bc4954
# Parent f73d057f787074df08523a03792bc968de615794
Default parameters for Graph.plot() and Graph.show()  Doc. Again.
diff git a/sage/graphs/generic_graph.py b/sage/graphs/generic_graph.py
a

b


14430  14430  7: [1.46..., 0.473...], 
14431  14431  8: [0.902..., 0.773...], 
14432  14432  9: [2.48..., 0.119...]} 
14433   
14434   :: 
14435   
 14433  
 14434  :: 
 14435  
14436  14436  sage: T = list(graphs.trees(7)) 
14437  14437  sage: t = T[3] 
14438  14438  sage: t.plot(heights={0:[0], 1:[4,5,1], 2:[2], 3:[3,6]}) 
14439   
14440   :: 
14441   
 14439  
 14440  :: 
 14441  
14442  14442  sage: T = list(graphs.trees(7)) 
14443  14443  sage: t = T[3] 
14444  14444  sage: t.plot(heights={0:[0], 1:[4,5,1], 2:[2], 3:[3,6]}) 
… 
… 

14450  14450  sage: t.set_edge_label(2,6,3/2) 
14451  14451  sage: t.set_edge_label(0,4,66) 
14452  14452  sage: t.plot(heights={0:[0], 1:[4,5,1], 2:[2], 3:[3,6]}, edge_labels=True) 
14453   
14454   :: 
14455   
 14453  
 14454  :: 
 14455  
14456  14456  sage: T = list(graphs.trees(7)) 
14457  14457  sage: t = T[3] 
14458  14458  sage: t.plot(layout='tree') 
14459   
14460   :: 
14461   
 14459  
 14460  :: 
 14461  
14462  14462  sage: t = DiGraph('JCC???@A??GO??CO??GO??') 
14463  14463  sage: t.plot(layout='tree', tree_root=0, tree_orientation="up") 
14464  14464  sage: D = DiGraph({0:[1,2,3], 2:[1,4], 3:[0]}) 
14465  14465  sage: D.plot() 
14466   
 14466  
14467  14467  sage: D = DiGraph(multiedges=True,sparse=True) 
14468  14468  sage: for i in range(5): 
14469  14469  ... D.add_edge((i,i+1,'a')) 
14470  14470  ... D.add_edge((i,i1,'b')) 
14471  14471  sage: D.plot(edge_labels=True,edge_colors=D._color_by_label()) 
14472   
 14472  
14473  14473  sage: g = Graph({}, loops=True, multiedges=True,sparse=True) 
14474  14474  sage: g.add_edges([(0,0,'a'),(0,0,'b'),(0,1,'c'),(0,1,'d'), 
14475  14475  ... (0,1,'e'),(0,1,'f'),(0,1,'f'),(2,1,'g'),(2,2,'h')]) 
… 
… 

14483  14483  sage: P = D.plot() 
14484  14484  
14485  14485  :: 
14486   
 14486  
14487  14487  sage: G=Graph({'a':['a','b','b','b','e'],'b':['c','d','e'],'c':['c','d','d','d'],'d':['e']},sparse=True) 
14488  14488  sage: G.show(pos={'a':[0,1],'b':[1,1],'c':[2,0],'d':[1,0],'e':[0,0]}) 
14489  14489  """ 
… 
… 

14493  14493  """ 
14494  14494  Shows the (di)graph. 
14495  14495  
14496   For syntax and lengthy documentation, see G.plot?. Any options not 
14497   used by plot will be passed on to the Graphics.show method. 
 14496  For syntax and lengthy documentation, see method 
 14497  :meth:`GenericGraph.plot`. Any options not used by plot will be passed 
 14498  on to the Graphics.show method. 
14498  14499  
14499  14500  .. NOTE:: 
14500  14501  
… 
… 

14526  14527  
14527  14528  See also the :mod:`sage.graphs.graph_latex` module for ways to use LaTeX 
14528  14529  to produce an image of a graph. 
14529   
14530   INPUT: 
14531   
14532   
 14530  
 14531  INPUT: 
 14532  
14533  14533   ``bgcolor``  rgb tuple (default: (1,1,1)) 
14534   
 14534  
14535  14535   ``vertex_size``  float (default: 0.06) 
14536   
 14536  
14537  14537   ``vertex_colors``  optional dictionary to specify 
14538  14538  vertex colors: each key is a color recognizable by tachyon (rgb 
14539  14539  tuple (default: (1,0,0))), and each corresponding entry is a list 
14540  14540  of vertices. If a vertex is not listed, it looks invisible on the 
14541  14541  resulting plot (it doesn't get drawn). 
14542   
 14542  
14543  14543   ``edge_colors``  a dictionary specifying edge 
14544  14544  colors: each key is a color recognized by tachyon ( default: 
14545  14545  (0,0,0) ), and each entry is a list of edges. 
diff git a/sage/graphs/graph_plot.py b/sage/graphs/graph_plot.py
a

b


26  26  
27  27  **Plot options** 
28  28  
29   Here is the list of options accepted by :meth:`GenericGraph.plot` and the 
30   constructor of :class:`GraphPlot`. 
 29  Here is the list of options accepted by :meth:`GenericGraph.plot 
 30  <sage.graphs.generic_graph.GenericGraph.plot>` and the constructor of 
 31  :class:`GraphPlot`. 
31  32  
32  33  .. csvtable:: 
33  34  :class: contentstable 
… 
… 

101  102  
102  103  .. NOTE:: 
103  104  
104   In order to define a default value permanently, you can add a couple of lines to 
105   :doc:`Sage's startup scripts <../../startup>`. Example :: 
 105  * While ``DEFAULT_PLOT_OPTIONS`` affects both ``G.show()`` and ``G.plot()``, 
 106  settings from ``DEFAULT_SHOW_OPTIONS`` only affects ``G.show()``. 
 107  
 108  * In order to define a default value permanently, you can add a couple of 
 109  lines to :doc:`Sage's startup scripts <../../startup>`. Example :: 
106  110  
107  111  sage: import sage.graphs.graph_plot 
108  112  sage: sage.graphs.graph_plot.DEFAULT_SHOW_OPTIONS['figsize'] = [4,4] 
… 
… 

684  688  """ 
685  689  Shows the (Di)Graph associated with this ``GraphPlot`` object. 
686  690  
687   For syntax and lengthy documentation, see :meth:`GraphPlot.plot`. 
 691  INPUT: 
 692  
 693  This method accepts all parameters of 
 694  :meth:`sage.plot.graphics.Graphics.show`. 
688  695  
689  696  .. NOTE:: 
690  697  
… 
… 

711  718  """ 
712  719  Returns a graphics object representing the (di)graph. 
713  720  
 721  INPUT: 
 722  
 723  The options accepted by this method are to be found in the documentation 
 724  of module :mod:`sage.graphs.graph_plot`. 
 725  
714  726  .. NOTE:: 
715  727  
716  728  See :mod:`the module's documentation <sage.graphs.graph_plot>` for 