Skip to content

How to re-order legends when using scprep.plot.rotate_scatter3 #100

@scottgigante

Description

@scottgigante

From @simonewebb at KrishnaswamyLab/PHATE#87 :

I am loving the output of PHATE for my dataset so far - great tool (thanks for your work on this).

Currently, I am trying to visually tweak the output of scprep.plot.rotate_scatter3d, in order that it looks a bit more pleasing. I have altered it as follows, and am very nearly happy with the result:

mpl.rcParams['animation.embed_limit'] = 2**256

scprep.plot.rotate_scatter3d(Y_phate_3d, c=labels, figsize=(15,10), label_prefix="PHATE", cmap=new_colors_3d,
legend_title="Fetal BM cell types",
title="PHATE visualisation of FBM progenitor differentiation", elev=10, azim=10,
legend_loc=[0.75,0.55], filename='phate_dpi_v11.mp4', rotation_speed=20, fps=60, dpi=400, ticklabels=False)

where:

labels = adata.obs["cell.labels_comb"].astype("object")
and
new_colors_3d = ['#c37d00', '#009500', '#fba100', '#0754ab', '#ffa0ff', '#a900a9', '#aaffaa', '#9ccbfc', '#e80000']

Good so far, but, the order of the legend labels are coming up in an order that is unintuitive to the biology. I'd like to alter this, and began by first attempting to alter the order of the categories given to "labels", from c=labels. However, this made no difference.

Could you please direct me to the best way to alter the order - or what arg would be responsible for the placement of this?

Would be very useful and improve the output a lot!

Thanks

Simone

*PS: if you have any ideas WRT altering amount of white space to the left and right of the .mp4 output that would also be very much appreciated

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions