Skip to content

Commit

Permalink
Bug fix: do not draw kamada graph when graph is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Zulko committed Dec 4, 2019
1 parent 806f22b commit d8f80a3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions dnacauldron/AssemblyMix/AssemblyMixBase/AssemblyMixPlotsMixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ def polar(xy):
def plot_connections_graph(self, ax=None, figsize=(20, 20)):

graph = self.uniquified_connection_graph

def fragment_label(i):
fragment = self.fragments_dict[i]
return "\n".join(
Expand All @@ -161,13 +160,14 @@ def fragment_label(i):
labels = {i: fragment_label(i) for i in graph}
if ax is None:
fig, ax = plt.subplots(1, 1, figsize=figsize)
nx.draw_kamada_kawai(
graph,
labels=labels,
font_color="k",
edge_color="grey",
font_size=12,
node_color="w",
node_size=3000,
)
if len(graph):
nx.draw_kamada_kawai(
graph,
labels=labels,
font_color="k",
edge_color="grey",
font_size=12,
node_color="w",
node_size=3000,
)
return ax

0 comments on commit d8f80a3

Please sign in to comment.