scverse / scverse/scanpy

Store predefined group colors as dict?

Open
#596 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Area - Plotting 🌺
Dominant language
Python
Stars
2.6k
Forks
779
Avg merge
1d 4h
Merged PRs (30d)
27

Description

Could we change colors for groups from being defined by an array of colors to being a dict mapping from the relevant key/ category to the color? I would find this more intuitive, and much easier to modify. Plus tools like seaborn can accept dicts directly as a palette:

import seaborn as sns

iris = sns.load_dataset("iris")
g = sns.FacetGrid(
    iris, 
    row="species", 
    hue="species", 
    palette={"setosa": "red", "versicolor": "green", "virginica": "blue"}
)
g.map(sns.kdeplot, "sepal_width").show()

example

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing group-color definitions and every place that consumes them, then check how the current array order relates to group keys or categories. Done means colors are represented by a key-to-color dict throughout the relevant plotting path, with tests or examples covering the new form.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.