Skip to content

Commit 8c41499

Browse files
author
artuurC
committed
Add background_size and equal_background_size to plotFlowSOM
1 parent 0a4d43f commit 8c41499

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/FlowSOM/plotting/_plot_helper_functions.py

+21-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ def plot_FlowSOM(
6060
view: str = "MST",
6161
background_values: np.array = None,
6262
background_cmap=gg_color_hue(),
63+
background_size=1.5,
64+
equal_background_size=False,
6365
node_sizes: np.array = None,
6466
max_node_size: int = 1,
6567
ref_node_size: int = None,
@@ -76,6 +78,10 @@ def plot_FlowSOM(
7678
:type background_values: np.array
7779
:param background_cmap: A colormap for the background colors
7880
:type background_cmap: Colormap
81+
:param background_size: The size of the background nodes relative to the nodes
82+
:type background_size: float
83+
:param equal_background_size: If True the background nodes will be equally sized
84+
:type equal_background_size: boolean
7985
:param node_sizes: An array with the node sizes. Will be scaled between 0
8086
and max_node_size and transformed with a sqrt. Default is the percentages
8187
:type node_sizes: np.array
@@ -124,7 +130,21 @@ def plot_FlowSOM(
124130

125131
# Add background
126132
if background_values is not None:
127-
background = add_nodes(layout, node_sizes * 1.5)
133+
if equal_background_size:
134+
background_size = np.repeat(max_node_size * background_size, len(background_values))
135+
else:
136+
background_size = (
137+
parse_node_sizes(
138+
fsom,
139+
view=view,
140+
node_sizes=None,
141+
max_node_size=max_node_size,
142+
ref_node_size=ref_node_size,
143+
equal_node_size=False,
144+
)
145+
* background_size
146+
)
147+
background = add_nodes(layout, background_size)
128148
b = mc.PatchCollection(background, cmap=background_cmap)
129149
if background_values.dtype == np.float64 or background_values.dtype == np.int64:
130150
b.set_array(background_values)

0 commit comments

Comments
 (0)