Skip to content

Legend alignment in dotplot #1103

Closed
Closed

Description

@LuckyMD

Hey!
The color bar and legend don't seem to align well... might be because i'm subsetting the object.

Here is what happens (reproducible example and my plot, which is even stranger with legend overlap):

Screenshot 2020-03-15 at 13 09 33

Screenshot 2020-03-15 at 13 02 52

import scanpy as sc
adata = sc.datasets.pbmc68k_reduced()
sc.pl.dotplot(adata[adata.obs.bulk_labels.isin(['Dendritic', 'CD14+ Monocyte', 'CD4+/CD25 T Reg']),], var_names=['HES4', 'TNFRSF4', 'SSU72'], groupby='bulk_labels', figsize=(8,8))

Versions:

scanpy==1.4.5.1 anndata==0.7.1 umap==0.3.10 numpy==1.18.1 scipy==1.4.1 pandas==1.0.1 scikit-learn==0.22.2 statsmodels==0.11.1 python-igraph==0.8.0 louvain==0.6.1

Also, matplotlib is 3.1.3

Activity

  1. ivirshup commented on Mar 16, 2020

    @ivirshup
    Member

    Huh. As far as I can tell, this seems to happen only if there are 3 or less groups.

  2. LuckyMD commented on Mar 17, 2020

    @LuckyMD
    ContributorAuthor

    This seems like a bad idea, no? It also seems to throw off the legend other than the colorbar.

  3. fidelram commented on Mar 25, 2020

    @fidelram
    Collaborator

    In #1127 I changed the way that the colorbar and size legend are plotted and should solve this problem.

  4. gabriellayi commented on May 25, 2020

    @gabriellayi

    Hi, I have the same problem, sorry that I just started learning python, so I don't really understand some of the improvements and I also tried some of them, it didn't work.
    Could you please let me know what kind of solution will be good for this issue?

    Thanks!
    Screen Shot 2020-05-24 at 17 43 08
    Screen Shot 2020-05-24 at 17 43 42

    Yi

  5. fidelram commented on May 27, 2020

    @fidelram
    Collaborator

    This is being fixed in #1210

    for the time being you can try to set dendrogram=False or you can install the branch with the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions