@@ -32,7 +32,7 @@ def plot_copula(data_flux1, data_flux2, n = 5, width = 900 , height = 600, expor
3232 fig = go .Figure (
3333 data = [go .Surface (z = copula )],
3434 layout = go .Layout (
35- height = height ,
35+ height = height ,
3636 width = width ,
3737 )
3838 )
@@ -48,7 +48,7 @@ def plot_copula(data_flux1, data_flux2, n = 5, width = 900 , height = 600, expor
4848 margin = dict (r = 30 , b = 30 , l = 30 , t = 50 ))
4949
5050 fig .layout .template = None
51-
51+
5252 fig .show ()
5353 fig_name = data_flux1 [1 ] + "_" + data_flux2 [1 ] + "_copula." + export_format
5454
@@ -97,7 +97,7 @@ def plot_corr_matrix(corr_matrix, reactions, removed_reactions=[], format="svg")
9797 removed_reactions -- A list with the removed reactions in case of a preprocess.
9898 If provided removed reactions are not plotted.
9999 """
100-
100+
101101 sns_colormap = [[0.0 , '#3f7f93' ],
102102 [0.1 , '#6397a7' ],
103103 [0.2 , '#88b1bd' ],
@@ -109,26 +109,26 @@ def plot_corr_matrix(corr_matrix, reactions, removed_reactions=[], format="svg")
109109 [0.8 , '#e8848b' ],
110110 [0.9 , '#e15e68' ],
111111 [1.0 , '#da3b46' ]]
112-
112+
113113 if removed_reactions != 0 :
114114 for reaction in reactions :
115115 index = reactions .index (reaction )
116116 if reaction in removed_reactions :
117117 reactions [index ] = None
118-
119- fig = px .imshow (corr_matrix ,
118+
119+ fig = px .imshow (corr_matrix ,
120120 color_continuous_scale = sns_colormap ,
121121 x = reactions , y = reactions , origin = "upper" )
122-
122+
123123 fig .update_layout (
124124 xaxis = dict (tickfont = dict (size = 5 )),
125125 yaxis = dict (tickfont = dict (size = 5 )),
126126 width = 900 , height = 900 , plot_bgcolor = "rgba(0,0,0,0)" )
127-
127+
128128 fig .update_traces (xgap = 1 , ygap = 1 , hoverongaps = False )
129-
129+
130130 fig .show ()
131-
131+
132132 fig_name = "CorrelationMatrix." + format
133133 pio .write_image (fig , fig_name , scale = 2 )
134134
@@ -141,18 +141,18 @@ def plot_dendrogram(dissimilarity_matrix, reactions , plot_labels=False, t=2.0,
141141 dissimilarity_matrix -- A matrix produced from the "cluster_corr_reactions" function
142142 reactions -- A list with the model's reactions
143143 plot_labels -- A boolean variable that if True plots the reactions labels in the dendrogram
144- t -- A threshold that defines a threshold that cuts the dendrogram
144+ t -- A threshold that defines a threshold that cuts the dendrogram
145145 at a specific height and colors the occuring clusters accordingly
146- linkage -- linkage defines the type of linkage.
146+ linkage -- linkage defines the type of linkage.
147147 Available linkage types are: single, average, complete, ward.
148148 """
149149
150150 fig = ff .create_dendrogram (dissimilarity_matrix ,
151151 labels = reactions ,
152- linkagefun = lambda x : hierarchy .linkage (x , linkage ),
152+ linkagefun = lambda x : hierarchy .linkage (x , linkage ),
153153 color_threshold = t )
154154 fig .update_layout (width = 800 , height = 800 )
155-
155+
156156 if plot_labels == False :
157157 fig .update_layout (
158158 xaxis = dict (
@@ -166,9 +166,9 @@ def plot_dendrogram(dissimilarity_matrix, reactions , plot_labels=False, t=2.0,
166166 yaxis = dict (
167167 title_font = dict (size = 10 ),
168168 tickfont = dict (size = 8 ) ) )
169-
169+
170170 fig .show ()
171-
171+
172172
173173
174174def plot_graph (G , pos ):
@@ -184,24 +184,24 @@ def plot_graph(G, pos):
184184 for u , v , data in G .edges (data = True ):
185185 x0 , y0 = pos [u ]
186186 x1 , y1 = pos [v ]
187-
187+
188188 edge_color = 'blue' if data ['weight' ] > 0 else 'red'
189-
190- fig .add_trace (go .Scatter (x = [x0 , x1 ], y = [y0 , y1 ], mode = 'lines' ,
191- line = dict (width = abs (data ['weight' ]) * 1 ,
189+
190+ fig .add_trace (go .Scatter (x = [x0 , x1 ], y = [y0 , y1 ], mode = 'lines' ,
191+ line = dict (width = abs (data ['weight' ]) * 1 ,
192192 color = edge_color ), hoverinfo = 'none' ,
193193 showlegend = False ))
194194
195195 for node in G .nodes ():
196196 x , y = pos [node ]
197197 node_name = G .nodes [node ].get ('name' , f'Node { node } ' )
198-
199- fig .add_trace (go .Scatter (x = [x ], y = [y ], mode = 'markers' ,
198+
199+ fig .add_trace (go .Scatter (x = [x ], y = [y ], mode = 'markers' ,
200200 marker = dict (size = 10 ),
201201 text = [node_name ],
202202 textposition = 'top center' ,
203203 name = node_name ,
204204 showlegend = False ))
205-
205+
206206 fig .update_layout (width = 800 , height = 800 )
207- fig .show ()
207+ fig .show ()
0 commit comments