diff --git a/scirpy/_plotting/_clonotypes.py b/scirpy/_plotting/_clonotypes.py index 409e18dc8..b33fbd863 100644 --- a/scirpy/_plotting/_clonotypes.py +++ b/scirpy/_plotting/_clonotypes.py @@ -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: @@ -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: