Open bengouts opened 5 months ago
@bengouts To ensure that the same colors are used in the scatterplot you have to pass "label"
to colorby
instead of the labels.
sample.protein.scatterplot(attribute='UMAP_PROT', colorby="label")
Quoting the documentation:
In case ‘label’ is provided then the stored paltte is used. If the values are strings, then a discrete color map is assumed. For numerical values a continuous color scale is used.
Oups, my mistake. I assumed it used the labels by default. Thanks!
Just one other example to higlight that default behaviour of color scale is misleading :
sample.protein.cluster(attribute='normalized_counts', method='graph-community', k=100)
sample.protein.add_row_attr("cluster_graph_community", sample.protein.get_labels())
sample.protein.heatmap(attribute='normalized_counts', splitby=sample.protein.row_attrs["cluster_graph_community"])
sample.protein.scatterplot(attribute='UMAP_PROT', colorby=sample.protein.row_attrs["cluster_graph_community"])
As of now the only to ensure that all plots have the same color is to store the value in the label
row attribute of the assay by using sample.protein.set_labels(sample.protein.row_attrs["cluster_graph_community"])
and then passing "label"
to the colorby
or splitby
parameters. The colors can be modified using sample.protein.set_palette()
as well. Whenever an array is passed to these parameters, the function has no way of knowing what that array was supposed to indicate.
However I agree that mosaic should use a consistent palette for any given array across all the plots. We can keep this ticket open.
Hi all,
I observed a very misleading behaviour with the color scale : the default color scheme is different from one plot to another, which is extremely misleading.
Then I plot the heatmap :
Then I plot the UMAP :
For instance, Cluster 1 is blue in the heatmap and red in the UMAP, which is extremely misleading.
Thanks for this very usefull and well documented library. Best regards, Benoit