afmslicer.plotting
¶
Plot processed images.
generate_gif(sliced_segments, outdir, img_name, duration=100, loop=0)
¶
Generate a GIF of all slices through the image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sliced_segments
|
NDArray
|
A three-dimensional array of slices through the image. |
required |
outdir
|
Path
|
Where to save the image to. |
required |
img_name
|
str
|
The original image filename, will have |
required |
duration
|
int
|
Duration between frames in the GIF, default is |
100
|
loop
|
int
|
Whether to loop the image, default is |
0
|
Source code in src/afmslicer/plotting.py
plot_all_layers(array, img_name=None, outdir=None, format=None, cmap=None)
¶
Plot a three-dimensional numpy array.
This function calls plot_layer() for each "slice" of a three-dimensional array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array
|
NDArray
|
Two-dimensional numpy array to be plotted, may be labelled or unlabelled data. |
required |
img_name
|
str
|
The image name from which the data is derived. |
None
|
outdir
|
str | Path
|
Target output directory, will be created if it does not exist. |
None
|
format
|
str
|
Image format for creating image. Default is |
None
|
cmap
|
str | ColorType
|
Colormap to plot as, defaults to |
None
|
Returns:
| Type | Description |
|---|---|
dict[int, tuple[Figure, Axes]]
|
Dictionary of Matplotlib |
Source code in src/afmslicer/plotting.py
plot_area_by_layer(area_per_layer, img_name=None, min_size=None, outdir=None, format=None, fwhm=None, log=False, grid=False)
¶
Plot the layer v total area of pores within it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
area_per_layer
|
list[list[float]]
|
A list of the total area of pores within each layer. |
required |
img_name
|
str
|
Image name. |
None
|
min_size
|
float
|
Minimum size of objects to include when summing the area by layer. |
None
|
outdir
|
str | Path
|
Output directory, if no |
None
|
format
|
str
|
Output file format as a string, defaults to |
None
|
fwhm
|
tuple[int, int]
|
Full width half max limits for subsetting the data. |
None
|
log
|
bool
|
Whether to plot with the logarithm (base10) of the number of pores. |
False
|
grid
|
bool
|
Whether to include a grid on the plot. |
False
|
Returns:
| Type | Description |
|---|---|
tuple[Figure, Axes]
|
Returns a tuple of Matplotlib |
Source code in src/afmslicer/plotting.py
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 250 251 252 253 254 255 256 257 258 259 260 | |
plot_layer(array, img_name=None, layer=None, outdir=None, format=None, cmap=None)
¶
Plot a two-dimensional numpy array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array
|
NDArray
|
Two-dimensional numpy array to be plotted, may be labelled or unlabelled data. |
required |
img_name
|
str
|
The image name from which the data is derived. |
None
|
layer
|
int
|
The layer that is being plotted. |
None
|
outdir
|
str | Path
|
Target output directory, will be created if it does not exist. |
None
|
format
|
str
|
Image format for creating image. Default is |
None
|
cmap
|
str
|
Colormap to plot as, defaults to |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Figure, Axes]
|
Matplotlib |
Source code in src/afmslicer/plotting.py
plot_pores_by_layer(pores_per_layer, img_name=None, outdir=None, format=None, log=False, grid=False)
¶
Plot the layer v number of pores within it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pores_per_layer
|
list[int]
|
A list of the number of pores in each layer. |
required |
img_name
|
str
|
Image name. |
None
|
outdir
|
str | Path
|
Output directory, if no |
None
|
format
|
str
|
Output file format as a string, defaults to |
None
|
log
|
bool
|
Whether to plot with the logarithm (base10) of the number of pores. |
False
|
grid
|
bool
|
Whether to include a grid on the plot. |
False
|
Returns:
| Type | Description |
|---|---|
tuple[Figure, Axes]
|
Returns a tuple of Matplotlib |