01mgfx
01mgfx

Reputation: 31

What's the appropriate Sage syntax to modify edge / vertex border thickness of a graph?

Sage is outstanding, in particular for graph theory. But actually I cannot find examples of how to change edge or vertex border thickness.

I've read this documentation without success:

I'm using this:

import sage.graphs.graph_plot
G = graphs.Grid2dGraph(4,4)
P = G.graphplot(vertex_labels=False, vertex_size=700, graph_border=False, edge_thickness=10)
P.show()

... but Sage still does not recognize the edge_thickness option.

Thanks in advance

Upvotes: 1

Views: 325

Answers (1)

Samuel Lelièvre
Samuel Lelièvre

Reputation: 3453

The requested feature works since Sage 7.3, thanks to

If you are running an older version of Sage, consider upgrading. Each new version brings improvements and bug fixes.

Using one of the latest versions of Sage:

sage: version()
'SageMath version 8.2.rc2, Release Date: 2018-04-10'

the edge_thickness parameter makes a noticeable difference.

Without specifying edge_thickness:

sage: import sage.graphs.graph_plot
sage: G = graphs.Grid2dGraph(4,4)
sage: P = G.graphplot(vertex_labels=False, vertex_size=700, graph_border=False)
sage: P.show()
Launched png viewer for Graphics object consisting of 25 graphics primitives

Grid graph with edge_thickness=1

Specifying edge_thickness=10:

sage: P = G.graphplot(vertex_labels=False, vertex_size=700, graph_border=False, edge_thickness=10)
sage: P.show()
Launched png viewer for Graphics object consisting of 25 graphics primitives

Grid graph with edge_thickness=10

Specifying edge_thickness=1 (same as default):

sage: P = G.graphplot(vertex_labels=False, vertex_size=700, graph_border=False, edge_thickness=1)
sage: P.show()
Launched png viewer for Graphics object consisting of 25 graphics primitives

Grid graph with edge_thickness=1

Upvotes: 1

Related Questions