我已经编写了一些代码,用于在jupyter笔记本中使用networkx显示二分图。我使用我所假设的Tex来渲染节点的标签。但是,我似乎无法使渲染的Tex字体的大小增加。有一个简单的方法吗?帮助会很棒。
import networkx as nx
% matplotlib inline
from networkx.algorithms import bipartite
B = nx.Graph()
B.add_nodes_from(['$x_1$','$x_2$','$x_3$'], s='o', c='#AA5555', bipartite=0) # Add the node attribute 'bipartite'
B.add_nodes_from(['$f_a$','$f_b$','$f_c$','$f_d$'], s='s', c='#55AAAA', bipartite=1)
B.add_edges_from([('$x_1$','$f_a$'),('$x_1$','$f_b$'),('$x_2$','$f_a$'),('$x_2$','$f_b$'),('$x_2$','$f_c$'),('$x_3$','$f_c$'),('$x_3$','$f_d$')])
pos = dict()
X, Y = bipartite.sets(B)
pos.update((n, (i,1)) for i, n in enumerate(X))
pos.update((n, (i+0.5,2)) for i, n in enumerate(Y))
disjointSetCount = 2
for disjointSet in range(0, disjointSetCount):
nx.draw(
B,
pos,
with_labels=True,
node_shape = 's' if disjointSet == 1 else 'o',
node_color = '#FFEEEE' if disjointSet==1 else '#EEEEFF',
node_size=1000,
nodelist = [
sNode[0] for sNode in filter(lambda x: x[1]["bipartite"]==disjointSet, B.nodes(data=True))
]
)
plt.savefig("img/15_Graphical_Models_12b.png") # save as png
答案 0 :(得分:1)
var measure = $odataresource("http://windows-10:8888/ChangeMeasure/");
var myMeasure = measure.odata().filter("ID",$scope.ngData[index].ID)
.query(function(data){
data[0].$update();
console.log("Everything went ok!")
},function(){
console.log("Oops, something wrong happened!")
});
的一个可选参数是nx.draw
。如果我设置font_size
我
那应该是很大的。