Skip to content
Snippets Groups Projects
Commit f01304ab authored by felix's avatar felix
Browse files

update plot-dataframe readout

parent bd67d8af
No related branches found
No related tags found
No related merge requests found
......@@ -341,6 +341,7 @@ class flow_circuit(circuit,object):
E=self.get_edges_data()
V=self.get_nodes_data()
self.set_pos()
fig=dx.plot_networkx( self.G, edge_list=self.list_graph_edges, node_list=self.list_graph_nodes, edge_data=E, node_data=V )
return fig
......@@ -42,7 +42,7 @@ def initialize_flux_circuit_from_crystal(crystal_type='default',periods=1):
def setup_default_flux_circuit(dict_pars):
kirchhoff_graph=initialize_flux_circuit_from_networkx(dict_pars['plexus'])
kirchhoff_graph.set_source_landscape(mode='dipole_border')
kirchhoff_graph.set_source_landscape(mode='dipole_point')
kirchhoff_graph.set_solute_landscape()
kirchhoff_graph.scales['diffusion']=dict_pars['diffusion']
......@@ -236,7 +236,7 @@ class flux_circuit(flow_circuit,object):
def get_edges_data(self):
de=pd.DataFrame(self.edges[['conductivity','flow_rate','absorption','peclet','length']])
de=pd.DataFrame(self.edges[['conductivity','flow_rate','absorption','uptake','peclet','length']])
de['weight']=np.power(self.edges['conductivity'].to_numpy(),0.25)*self.draw_weight_scaling
return de
......@@ -231,21 +231,24 @@ class circuit:
return pos
def set_pos(self,pos_data):
def set_pos(self,pos_data={}):
pos_key='pos'
reset_layout=False
nodata=False
if len(pos_data.values())==0:
nodata=True
for j,n in enumerate(self.G.nodes()):
if pos_key not in self.G.nodes[n]:
reset_layout=True
if reset_layout:
if reset_layout and nodata:
print('set networkx.spring_layout()')
pos = nx.spring_layout(self.G)
for j,n in enumerate(self.G.nodes()):
self.G.nodes[n]=pos[n]
nx.set_node_attributes(self.G, pos, 'pos')
else:
for j,n in enumerate(self.G.nodes()):
self.G.nodes[n]=pos_data[n]
nx.set_node_attributes(self.G, pos_data, 'pos')
def set_scale_pars(self, new_parameters):
......@@ -258,6 +261,7 @@ class circuit:
# output
def plot_circuit(self):
self.set_pos()
fig=dx.plot_networkx( self.G, edge_list=self.list_graph_edges, node_list=self.list_graph_nodes )
return fig
......@@ -148,7 +148,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.9"
"version": "3.7.3"
}
},
"nbformat": 4,
......
......@@ -26925,7 +26925,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.9"
"version": "3.7.3"
}
},
"nbformat": 4,
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment