larmor.plot#
Plots of Larmor’s results, drawn with matplotlib.
Each function draws on a matplotlib Axes, either one you pass or a new
figure, and returns it, so the plot can be changed or saved with matplotlib.
For now it holds the bar chart of a simulated voxel’s signal breakdown.
Draws a voxel's signal breakdown as three stacked bars. |
- larmor.plot.plot_signal_breakdown(breakdown, ax=None)#
Draws a voxel’s signal breakdown as three stacked bars.
The bars are the signal at three steps: the water in the voxel with no decay, after the T1 and T2 (or T2*) decay at the echo time, and after the diffusion weighting of the volume. Each bar is split into the voxel’s compartments, named in plain words, with each bundle in colours of its own. The total of each bar is written above it; with noise, the noise floor is a dashed line, named in the legend.
The short tick labels name the steps: “No decay” is the water in the voxel, “T1/T2 decay, TE 80 ms” the signal after relaxation at that echo time (T2* for a gradient echo), and “Diffusion, b 3000” the signal after the diffusion weighting of the volume. The legend sits below the axes in up to two columns; with two bundles, each column lists one bundle’s compartments. When the figure is too narrow for two columns, the legend has one.
- Parameters:
breakdown (SignalBreakdown) – The breakdown, from
larmor.simulation.signal_breakdown.ax (Axes | None) – The axes to draw on. Defaults to None: a new figure and axes.
- Returns:
The axes drawn on.
- Return type:
Axes
Example
>>> from larmor.plot import plot_signal_breakdown >>> ax = plot_signal_breakdown(breakdown) >>> ax.figure.savefig("breakdown.png")