Skip to content

Dict param to plots #646 - #661

Merged
fidelram merged 7 commits into
scverse:masterfrom
fidelram:dict_param_to_plots
May 27, 2019
Merged

fidelram merged 7 commits into
scverse:masterfrom
fidelram:dict_param_to_plots

Conversation

@fidelram

@fidelram fidelram commented May 23, 2019 •

Copy link
Copy Markdown
Collaborator

This PR addresses #646 by adding the option to pass a dict to the plotting functions heatmap, dotplot, matrixplot, tracksplot and stacked_violin.

Now, when var_names is a dictionary the var_group_labels and var_group_positions are set such that the dictionary key is a label and the group is the dict values. In the following example the 'brackets' plot on top of the image are prepared based on the markers dictionary:

marker_genes_dict = {'B-cell': ['CD79A', 'MS4A1'], 
                     'T-cell': 'CD3D',
                     'T-cell CD8+': ['CD8A', 'CD8B'],
                     'NK': ['GNLY', 'NKG7'],
                     'Myeloid': ['CST3', 'LYZ'],
                     'Monocytes': ['FCGR3A'],
                     'Dendritic': ['FCER1A']}
# use marker genes as dict to group them
ax = sc.pl.dotplot(pbmc, marker_genes_dict, groupby='bulk_labels')

image

This PR also introduces a small change in sc.pl.stacked_violin by setting cut=0 as default parameter for seaborn.violin. This produces in my opinion better plots by removing the extension of the violin past extreme points. This is specially useful to avoid the violin plot to extend below zero expression values.

Update: I set the dependencies to matplotlib==3.0.* and scipy==1.2 to solve failing tests. More details in the conversation

fidelram added 2 commits May 23, 2019 14:44
…tacked_violin and tracksplot. Added cut=0 as default for stacked_violin plots for more pleasing results.
fidelram added a commit to fidelram/scanpy-tutorials that referenced this pull request May 23, 2019
fidelram added a commit to fidelram/scanpy-tutorials that referenced this pull request May 23, 2019
@fidelram

Copy link
Copy Markdown
Collaborator Author

Some of the tests fail for reasons unrelated to the PR (test_preprocessing). Locally all tests pass for me. Any ideas?

@flying-sheep

Copy link
Copy Markdown
Member

I think it’s again some flakiness of some dependency (or our interaction with it)

@fidelram

Copy link
Copy Markdown
Collaborator Author

@flying-sheep I see that the same tests are failing in other PRs. Do you have any idea what and when some change was introduced that broke the tests

@fidelram

Copy link
Copy Markdown
Collaborator Author

Looking at the commits page I can see that the tests has been failing for some days already.

First was a problem with a notebook test (test_pbmc3k) that seems innocuous but should be addressed. This is related to release 1.4.3 (85acb6c). The commits are unrelated to the failing test so I assume that some dependency was updated

However, after this commit 115d635 more errors are found. But again, I don't see any relevant changes that will cause the problems.

One of the errors is that statsmodels is using a deprecated module from scipy.misc:

>   from scipy.misc import factorial
E   ImportError: cannot import name 'factorial'
../../../virtualenv/python3.6.7/lib/python3.6/site-packages/statsmodels/distributions/edgeworth.py:7: ImportError

This was introduced after scipy 1.3 was recently updated (statsmodels/statsmodels#5759). It seems that currently, the only solution is to install statsmodels directly from the master branch. Or downgrade scipy.

@fidelram

Copy link
Copy Markdown
Collaborator Author

setting scipy==1.2 fixes several errors but there is another one maybe related to matplotlib.

@fidelram

Copy link
Copy Markdown
Collaborator Author

The remaining failed test is related to matplotlib 3.1.0 and 3d scatter plots. There is a report of a similar error (matplotlib/matplotlib#14298). My suggestion is to wait for those issues to be solved and then upgrade the dependencies.

@fidelram
fidelram merged commit d531986 into scverse:master May 27, 2019
@flying-sheep

Copy link
Copy Markdown
Member

Could you please add comments to the requirements.txt (need to be on their own lines)?

This way, in case we forget, we’ll have reminders why the ==s are there.

@fidelram

Copy link
Copy Markdown
Collaborator Author

@flying-sheep good idea. Added in PR #664

falexwolf added a commit to scverse/scanpy-tutorials that referenced this pull request Jun 5, 2019
@fidelram
fidelram deleted the dict_param_to_plots branch August 15, 2019 09:21
awnimo pushed a commit to dpeerlab/scanpy that referenced this pull request Dec 17, 2019
Added a dict param to plots scverse#646, updated docstring examples and fixed failing tests due to dependencies.
falexwolf pushed a commit to scverse/scanpy-tutorials that referenced this pull request Jul 14, 2020
* updated notebook after scverse/scanpy#661

* updated visualization tutorial after scverse/scanpy#1210  Also rewrote some parts to make them more clear

* updated notebook after @falexwolf review

* moved notebook to plotting folder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants