修改图形的边/顶点边框粗细的Sage语法是什么?

时间:2018-04-13 18:04:13

标签: python sage

Sage非常出色,尤其是图论。但实际上我找不到如何改变边缘或顶点边界厚度的例子。

我看过https://[tenant].sharepoint.com/_vti_bin/DelveApi.ashx/authtoken/loki?d=XXXXXXXXXXXX但没有成功:

我正在使用它:

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()

...但Sage仍然无法识别edge_thickness选项。

提前致谢

1 个答案:

答案 0 :(得分:1)

自Sage 7.3起,请求的功能正常运行,感谢

如果您运行的是旧版Sage,请考虑升级。 每个新版本都带来了改进和错误修复。

使用最新版本的Sage之一:

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

edge_thickness参数会产生显着差异。

未指定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

指定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

指定edge_thickness=1(与默认值相同):

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