如何使用Travis CI环境变量在Meteor.settings中设置API密钥?我尝试添加名为import networkx as nx
import matplotlib.pyplot as plt
#Build the graph
#Please note, the code here is as per the original post
G=nx.Graph()
G = nx.complete_graph(5)
mapping = {0:'aaaaaaa',1:'bbbbbbb',2:'ccccccc', 3:'dddddddd', 4:'eeeeeeeee'}
G = nx.relabel_nodes(G,mapping)
plt.figure(figsize=(10,10), facecolor="w", frameon=False)
#Get a graph layout
pos = nx.graphviz_layout(G, prog="fdp") #calculate position (x,y) coordinates
#Here is an alternative layout, please see below.
#pos = nx.layout.spring_layout(G)
nx.draw_networkx_nodes(G,pos,node_size=1200,node_shape='^',node_color='0.75')
nx.draw_networkx_edges(G,pos, width=2,edge_color='r')
#Show the original position of the labels using a Green colour.
nx.draw_networkx_labels(G,pos,font_color='g')
#Please note, the code below uses the original idea of re-calculating a dictionary of adjusted label positions per node.
label_ratio = 1.0/8.0
pos_labels = {}
#For each node in the Graph
for aNode in G.nodes():
#Get the node's position from the layout
x,y = pos[aNode]
#Get the node's neighbourhood
N = G[aNode]
#Find the centroid of the neighbourhood. The centroid is the average of the Neighbourhood's node's x and y coordinates respectively.
#Please note: This could be optimised further
cx = sum(map(lambda x:pos[x][0], N)) / len(pos)
cy = sum(map(lambda x:pos[x][1], N)) / len(pos)
#Get the centroid's 'direction' or 'slope'. That is, the direction TOWARDS the centroid FROM aNode.
slopeY = (y-cy)
slopeX = (x-cx)
#Position the label at some distance along this line. Here, the label is positioned at about 1/8th of the distance.
pos_labels[aNode] = (x+slopeX*label_ratio, y+slopeY*label_ratio)
#Finally, redraw the labels at their new position.
nx.draw_networkx_labels(G,pos=pos_labels,fontsize=2)
#Show the figure
plt.show()
的新环境变量:
METEOR_SETTINGS
但是我收到以下错误: TypeError:无法读取未定义的属性“app_id”。除了使用'{
"facebook_keys": {
"app_id": "1234567890",
"app_secret": "1234567890"
},
"instagram_keys": {
"client_id": "1234567890",
"client_secret": "1234567890",
"access_token": "1234567890"
}
}'
的测试外,所有测试都运行良好。