-
Notifications
You must be signed in to change notification settings - Fork 16
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
Plot proportion of cells per level as label #54
Comments
Hi @Cumol Thanks for giving {clustree} a go! If I am understanding you correctly you want to add a label with the proportion of the total samples that belong to each cluster (something like This sounds like something that should be easy to do but unfortunately I don't think that it is possible at the moment. It is easy to add the cluster size as a label: clustree(iris_clusts, prefix = "K", node_label = "size") But I don't think it is possible to do a proportion due to the way the node aggregation functions work. I think I might have a way to make this possible but I need to try some things and see if they work. I will comment here if I am able to come up with a solution. Thanks for raising the issue 🎉! I hadn't considered this a problem before and I think it's functionality we should have 😸. |
Thanks for the quick reply! I found the solution for "size" and if I understood correctly, "size" is calculated internally, which is why you can pass it as a node label. I was wondering whether the total_samples is also calculated internally and it would be possible to do Or allow general access to "resolution statistics". I saw another issue where someone calculated the statistics beforehand and then added the values where needed, but that looked too complex for me :D |
Yeah, unfortunately that won't work the way things are set up at the moment. I think the workaround I have thought will make that possible but I will have to try and implement it to see. |
Ok, my solution didn't work quite as well as I had hoped but I have come up with a slightly hacky workaround for your specific case. Try something like this and see if it gives you what you want. # You need to replace 150 here with however many samples you have
# I think the only way to do this is to hard code it for now
prop_samples <- function(x) {length(x) / 150}
clustree(YOUR_DATA, prefix = "YOUR_PREFIX", node_label = "ANY_METADATA_COLUMN",
node_label_aggr = "prop_samples") |
Will give it a try and let you know. |
@Cumol Was this helpful in the end? |
I'm not Cumol but yes this works very nicely, I'm using PS: I was hoping to be able to say |
Please open a new issue if this is a feature you would like to have. At the moment there is no parameter for controlling the edge colour. |
I was wondering how I could plot a label that contains the proportion of cells in the current cluster by resolution/clustering depth.
The text was updated successfully, but these errors were encountered: