Skip to content

Commit

Permalink
Merge pull request #292 from icbi-lab/no-loops
Browse files Browse the repository at this point in the history
Do not plot self-loop edges in clonotype network
  • Loading branch information
grst authored Sep 7, 2021
2 parents a0715b9 + 5c24059 commit 6f187bb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scirpy/_plotting/_clonotypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ def clonotype_network(
clonotype_res = adata.uns[clonotype_key]
coords, adj_mat = _graph_from_coordinates(adata, clonotype_key)
nx_graph = nx.Graph(_distance_to_connectivity(adj_mat))
# in 2.6 networkx added functionality to draw self-loops. We don't want
# them plotted, so we remove them here
nx_graph.remove_edges_from(nx.selfloop_edges(nx_graph))

# Prepare figure
if ax is None:
Expand Down Expand Up @@ -501,8 +504,9 @@ def _aggregate_per_dot_continuous(values):
edge_color=edges_color,
edge_cmap=edges_cmap,
)
edge_collection.set_zorder(-1)
edge_collection.set_rasterized(sc.settings._vector_friendly)
if edge_collection != []:
edge_collection.set_zorder(-1)
edge_collection.set_rasterized(sc.settings._vector_friendly)

# add clonotype labels
if show_labels:
Expand Down

0 comments on commit 6f187bb

Please sign in to comment.