New plot function to draw the relations between 2 categorical adata.obs variables?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 779
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 27
Description
What kind of feature would you like to request?
New plotting function: A kind of plot you would like to seein sc.pl?
Please describe your wishes
Hello Scanpy,
Thank you for developing this amazing package.
I have 2 categorical variables in adata.obs
adata_sub2.obs['patient']
AAACCTGAGGTTACCT-1-C106_N_1_1_0_c1_v2 C106_N
AAACCTGGTCAGAAGC-1-C106_N_1_1_0_c1_v2 C106_N
AAACCTGGTGCTCTTC-1-C106_N_1_1_0_c1_v2 C106_N
AAACCTGTCCCATTAT-1-C106_N_1_1_0_c1_v2 C106_N
AAACCTGTCGGAGCAA-1-C106_N_1_1_0_c1_v2 C106_N
...
TTTGCGCAGACACGAC-1-SMC25T SMC25T
TTTGCGCCATGGAATA-1-SMC25T SMC25T
TTTGCGCCATGTTCCC-1-SMC25T SMC25T
TTTGGTTGTAGGGTAC-1-SMC25T SMC25T
TTTGTCAAGAGGGATA-1-SMC25T SMC25T
Name: patient, Length: 44245, dtype: category
Categories (39, object): ['C106_N', 'C126_N', 'C130_N', 'C133_N', ..., 'C138_T', 'C168_T', 'SMC17T', 'SMC20T']
adata_sub2.obs['type']
AAACCTGAGGTTACCT-1-C106_N_1_1_0_c1_v2 Normal
AAACCTGGTCAGAAGC-1-C106_N_1_1_0_c1_v2 Normal
AAACCTGGTGCTCTTC-1-C106_N_1_1_0_c1_v2 Normal
AAACCTGTCCCATTAT-1-C106_N_1_1_0_c1_v2 Normal
AAACCTGTCGGAGCAA-1-C106_N_1_1_0_c1_v2 Normal
...
TTTGCGCAGACACGAC-1-SMC25T NMCAD
TTTGCGCCATGGAATA-1-SMC25T NMCAD
TTTGCGCCATGTTCCC-1-SMC25T NMCAD
TTTGGTTGTAGGGTAC-1-SMC25T NMCAD
TTTGTCAAGAGGGATA-1-SMC25T NMCAD
Name: type, Length: 44245, dtype: category
Categories (3, object): ['Normal', 'NMCAD', 'MCAD']
I know Scanpy has sc.pl.matrixplot(), and we can make matrix plot for gene set score, like
sc.pl.matrixplot(adata_sub2, var_names=['Normal_signature'], groupby='patient', use_raw=True, dendrogram=False, cmap='inferno', standard_scale='var', swap_axes=True, save='27.pdf')
Could you please let me know whether Scanpy can make a matrixplot-like plot showing the 'type' grouped by 'patient'? like:
sc.pl.matrixplot(adata_sub2, var_names=['type'], groupby='patient', palette={'Normal': 'blue', 'NMCAD': 'green', 'MCAD': 'red'}, dendrogram=False, swap_axes=True, save='27.pdf')
Thank you!
Best,
Yuanjian
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the existing sc.pl.matrixplot entry point and the examples using adata.obs['patient'] and adata.obs['type']. Clarify the expected matrixplot-like behavior for two categorical variables, including palette handling and axis grouping; done means the requested relationship can be plotted through the sc.pl interface.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100