Hi folks,
I want to change the color of the “var_group_labels” at the top of a dotplot body. I can change the color of other parts of the graph, such as the “groupby” labels, but I cannot figure out how to do it for the labels at the top.
Example of changing a “groupby” label, similar to what I would like to do for the “var_group_labels”:
import scanpy as sc
pbmc = sc.datasets.pbmc68k_reduced()
sc.tl.leiden(pbmc, key_added='clusters', resolution=0.5, flavor="igraph", n_iterations=2)
sc.tl.rank_genes_groups(
pbmc,
groupby='clusters',
method="wilcoxon",
key_added = "dea_clusters"
)
#Re-do dendrogram to ensure names match up
sc.tl.dendrogram(pbmc,
groupby="clusters")
dp = sc.pl.rank_genes_groups_dotplot(pbmc,
groupby = 'clusters',
show = False,
key = "dea_clusters",
return_fig = True)
axes = dp.get_axes()
ax = axes['mainplot_ax']
for l in (ax.get_yticklabels()):
if l.get_text() == '5':
l.set_color("blue")
dp.show()
scanpy version 1.11.0
Bonus question: The above code displays two separate plots, how can I make it so that it only shows the altered plot?