Here's a hackish solution I got by digging into the graph_plot sourcecode: http://git.sagemath.org/sage.git/tree/src/sage/graphs/graph_plot.py The relevant lines are 424 - 426.
I created a GraphPlot object and modified the labels there instead of in the original graph. G=DiGraph({0:[1,2]}) Gplot = G.graphplot() # Extract relevant components node_list = Gplot._nodelist pos_dict = Gplot._pos # Define list or dict of labels (same length as node_list) label_list = ["Ho","Hi","Hi"] # Modify vertex labels Gplot._plot_components['vertex_labels'] = [text(label, pos_dict[node], rgbcolor=(0,0,0), zorder=8) for node,label in zip(node_list,label_list)] Gplot.show() You could probably condense it into a two or three liner. It seems like it should also be possible to label vertices with non-text as well (e.g. other graphics components). Regards, Ze On Tuesday, October 14, 2014 2:50:05 AM UTC-7, Jori Mantysalo wrote: > > On Tue, 14 Oct 2014, Nathann Cohen wrote: > > >> G=DiGraph({0:[1,2]}) > >> G.set_edge_label(0,1,'Hi!') > >> G.set_edge_label(0,2,'Hi!') > >> > >> (But ".relabel(lambda e: ...)" -syntax is easier, I think.) > > > > Yes but we can't do the same for the vertices of a graph, of we would > > have no way to differentiate them afterwards. It should really be a > > plot parameter. > > That was what I was thinking. I don't know if "relabel" is good name for > parameter of plot(). Maybe not. > > -- > Jori Mäntysalo > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.