Skip to content

Commit

Permalink
modified plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
ajitjohnson committed Apr 25, 2024
1 parent 3e5dd74 commit c0e3e07
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions scimap/plotting/heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ def plot_category_heatmap_vectorized(data,
os.makedirs(saveDir)
full_path = os.path.join(saveDir, fileName)
plt.savefig(full_path, dpi=300)
plt.close(fig)
print(f"Saved heatmap to {full_path}")
else:
plt.show()
Expand Down
11 changes: 9 additions & 2 deletions scimap/tests/test_pl.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import pytest
import os
import anndata as ad
import matplotlib.pyplot as plt
import unittest


# load data
@pytest.fixture
Expand All @@ -22,7 +23,13 @@ def adata():
# heatmap
def test_heatmap (adata):
from scimap.plotting.heatmap import heatmap
heatmap(adata, groupBy='phenotype', standardScale='column')
saveDir = os.getcwd() + '/testFigures'
fileName = 'heatmap.png'
heatmap(adata, groupBy='phenotype', standardScale='column', saveDir=saveDir, fileName=fileName)
# check the file exist
full_path = os.path.join(saveDir, fileName)
assert os.path.exists(full_path), f"File was not created: {full_path}"




Expand Down
Binary file added testFigures/heatmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c0e3e07

Please sign in to comment.