-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from SarahOuologuem/fix_132
Small improvements in mu.pl.scatter()
- Loading branch information
Showing
2 changed files
with
39 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import pytest | ||
|
||
import numpy as np | ||
from scipy import sparse | ||
import pandas as pd | ||
from anndata import AnnData | ||
import muon as mu | ||
from muon import MuData | ||
import matplotlib | ||
|
||
matplotlib.use("Agg") | ||
|
||
|
||
@pytest.fixture() | ||
def mdata(): | ||
mdata = MuData( | ||
{ | ||
"mod1": AnnData(np.arange(0, 100, 0.1).reshape(-1, 10)), | ||
"mod2": AnnData(np.arange(101, 2101, 1).reshape(-1, 20)), | ||
} | ||
) | ||
mdata.var_names_make_unique() | ||
yield mdata | ||
|
||
|
||
class TestScatter: | ||
def test_pl_scatter(self, mdata): | ||
mdata = mdata.copy() | ||
np.random.seed(42) | ||
mdata.obs["condition"] = np.random.choice(["a", "b"], mdata.n_obs) | ||
mu.pl.scatter(mdata, x="mod1:0", y="mod2:0", color="condition") |