Skip to content
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

Color reflecting cluster size/number instead of level #20

Closed
tiagobrc opened this issue Aug 6, 2018 · 5 comments
Closed

Color reflecting cluster size/number instead of level #20

tiagobrc opened this issue Aug 6, 2018 · 5 comments

Comments

@tiagobrc
Copy link

tiagobrc commented Aug 6, 2018

Hi, congrats on the excellent package,

I was wondering if it is possible to color the cluster nodes reflecting the size in the same way Seurat does. I did by hand in Illustrator to make my point more clear.

rplot01

Thank you!

@lazappi
Copy link
Owner

lazappi commented Aug 6, 2018

Hi @tiagobrc

Thanks for giving clustree a go!

You can do this by setting the node_colour option to "cluster". Here is an example using the example Iris dataset:

library(clustree)
clustree(iris_clusts, prefix = "K", node_colour = "cluster")

cluster_colour

As you can see this kind of half works, the nodes are coloured by the right variable, but it uses a continuous scale instead of a discrete one. That should be pretty easy to fix, I'll try to push something to the development version soon.

@lazappi
Copy link
Owner

lazappi commented Aug 6, 2018

Hi @tiagobrc

I've just made a change to the development version that fixed this. Here is the output of the same Iris example using the development version (v0.2.2.9001):

clustree(iris_clusts, prefix = "K", node_colour = "cluster")

cluster_colour_fixed

You can install the development version using.

devtools::install_github("lazappi/clustree@develop")

@tiagobrc
Copy link
Author

tiagobrc commented Aug 6, 2018

Amazing @lazappi!

It worked very well.
Thank you so much for the quick implement. Very nice; it let me grasp the cluster tree from the perspective of Seurat.

Best regards,

Tiago

@lazappi
Copy link
Owner

lazappi commented Aug 6, 2018

Great!

Just a word of caution of doing this. It could potentially be misleading to people looking at it as nodes with the same colour aren't necessarily related. For example in the image you originally posted Cluster 0 is mostly on the left of the tree but is in the middle at higher resolutions. Someone looking at it might think the cluster has moved when what has actually changed is the relative sizes of the clusters.

@tiagobrc
Copy link
Author

tiagobrc commented Aug 6, 2018

Thank you for the comment.
I was aware of this. Definitely, I would avoid using this color coding to people/presentations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants