You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, sc.pl.umap provides an option to plot cells with higher values on top using an internal sorting step (np.argsort). However, for some use cases, it’s desirable to plot cells with the highest absolute values on top to highlight both large positive and large negative values in continuous color mappings.
Proposed Solution
Add a new option, such as sort_order='abs', to plot the highest absolute values on top, while preserving the original behavior as the default.
With this feature, cells with the largest magnitudes (either positive or negative) would be displayed on top, making them more visually prominent when using diverging color maps.
if sort_order and value_to_plot is not None and color_type == "cont":
# Higher values plotted on top, null values on bottom
order = np.argsort(-color_vector, kind="stable")[::-1]
I suggest
if sort_order and value_to_plot is not None and color_type == "cont":
if sort_order == "abs":
order = np.argsort(-np.abs(color_vector), kind="stable")[::-1]
else:
order = np.argsort(-color_vector, kind="stable")[::-1]
Thank you.
The text was updated successfully, but these errors were encountered:
Description
Currently, sc.pl.umap provides an option to plot cells with higher values on top using an internal sorting step (np.argsort). However, for some use cases, it’s desirable to plot cells with the highest absolute values on top to highlight both large positive and large negative values in continuous color mappings.
Proposed Solution
Add a new option, such as sort_order='abs', to plot the highest absolute values on top, while preserving the original behavior as the default.
Example
Here’s how the option could be used in practice:
With this feature, cells with the largest magnitudes (either positive or negative) would be displayed on top, making them more visually prominent when using diverging color maps.
Suggested Implementation
Instead of
I suggest
Thank you.
The text was updated successfully, but these errors were encountered: