Skip to content

Commit 250fae3

Browse files
authored
Merge pull request #11 from dpeng28/master
allowed users to customize heatmap size
2 parents e75060d + 65bfa2a commit 250fae3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pySingleCellNet/plots.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from sklearn.metrics import f1_score
1919
from .utils import *
2020

21-
def heatmap_scores(adata: AnnData, groupby: str, vmin: float = 0, vmax: float = 1, obsm_name='SCN_score', order_by: str = None):
21+
def heatmap_scores(adata: AnnData, groupby: str, vmin: float = 0, vmax: float = 1, obsm_name='SCN_score', order_by: str = None, fsize: list = [5, 6]):
2222
"""
2323
Plots a heatmap of single cell scores, grouping cells according to a specified .obs column and optionally ordering within each group.
2424
@@ -29,8 +29,9 @@ def heatmap_scores(adata: AnnData, groupby: str, vmin: float = 0, vmax: float =
2929
vmax (float, optional): Maximum value for color scaling. Defaults to 1.
3030
obsm_name (str, optional): The key in .obsm to retrieve the matrix for plotting. Defaults to 'SCN_score'.
3131
order_by (str, optional): The name of the column in .obs used for ordering cells within each group. Defaults to None.
32-
33-
Returns:
32+
fsize (list, optional): The figure size. Defaults to [5, 6].
33+
34+
Returns:
3435
None: The function plots a heatmap and does not return any value.
3536
"""
3637
# Create a temporary AnnData object with the scores matrix and all original observations
@@ -49,7 +50,7 @@ def heatmap_scores(adata: AnnData, groupby: str, vmin: float = 0, vmax: float =
4950
adTemp = adTemp[sorted_order, :]
5051

5152
# Set figure dimensions and subplot adjustments
52-
fsize = [5, 6]
53+
5354
plt.rcParams['figure.subplot.bottom'] = 0.25
5455

5556
# Plot the heatmap with the sorted and grouped data

0 commit comments

Comments
 (0)