densityPlot2D
Short Description
The sm.pl.densityPlot2D
function crafts 2D density plots to visualize expression
levels of one or two specified markers. When a single marker is provided, it depicts
its expression distribution across the dataset. With two markers, it contrasts the expression
of the first against the second, offering insights into their co-expression or distribution patterns.
Function
densityPlot2D(adata, markerA, markerB=None, layer=None, subset=None, imageid='imageid', ncols=None, cmap='jet', figsize=(3, 3), hline='auto', vline='auto', fontsize=None, dpi=100, xticks=None, yticks=None, saveDir=None, fileName='densityPlot2D.pdf')
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata |
AnnData
|
Annotated data matrix containing single-cell gene expression data. |
required |
markerA |
str
|
The name of the first marker whose expression will be plotted. |
required |
markerB |
list
|
The name of the second marker or a list of second markers whose expression will be plotted.
If not provided, a 2D density plot of |
None
|
layer |
str or list of str
|
The layer in adata.layers that contains the expression data to use.
If None, adata.X is used. use |
None
|
subset |
list
|
|
None
|
imageid |
str
|
Column name of the column containing the image id. Use in conjunction with |
'imageid'
|
ncols |
int
|
The number of columns in the grid of density plots. |
None
|
cmap |
str
|
The name of the colormap to use. Defaults to 'jet'. |
'jet'
|
figsize |
tuple
|
The size of the figure in inches. |
(3, 3)
|
hline |
float or auto
|
The y-coordinate of the horizontal line to plot. If set to |
'auto'
|
vline |
float or auto
|
The x-coordinate of the vertical line to plot. If set to |
'auto'
|
fontsize |
int
|
The size of the font of the axis labels. |
None
|
dpi |
int
|
The DPI of the figure. Use this to control the point size. Lower the dpi, larger the point size. |
100
|
xticks |
list of float
|
Custom x-axis tick values. |
None
|
yticks |
list of float
|
Custom y-axis tick values. |
None
|
saveDir |
str
|
The directory to save the output plot. |
None
|
fileName |
str
|
The name of the output file. Use desired file format as suffix (e.g. |
'densityPlot2D.pdf'
|
Returns:
Name | Type | Description |
---|---|---|
Plot |
image
|
If |
Example
1 2 3 4 5 |
|
Source code in scimap/plotting/densityPlot2D.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
|