-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to re-order legends when using scprep.plot.rotate_scatter3 #100
Comments
The easiest way to customise the legend is by turning off the default legend and creating your own using
|
Hi Scott, Your advice has worked a treat - thank you so much (and for the very swift reply) Do you have any recommendations for altering the amount of white space surrounding the fig when saved as mp4 (i.e., how i could possibly increase or decrease white space to the left/right hand side of the rotating grid?) Thanks Simone |
Ah sorry I forgot about that part of the question! This stackoverflow answer might help you, though I'm not very experienced with this. |
Amazing, thanks so much, Scott |
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
The text was updated successfully, but these errors were encountered: