plot_source_grid¶
- hrtfpykit.plots.plot_source_grid(hrtf, show=True, show_titles=True, show_labels=True, show_legends=True)¶
Plot the current HRTF source grid in 3D.
plot_source_gridreads Cartesian source positions fromhrtf.Sourcesand draws the current source grid. It uses equal 3D axis limits and adds direction markers when labels are enabled.The plot reflects the source grid currently stored in the HRTF object, including any source selection already applied to that object.
- Parameters:
show (bool, default=True) – If True, display the figure before returning.
show_titles (bool, default=True) – If False, suppress generated default figure titles.
show_labels (bool, default=True) – If False, suppress generated axis labels and colorbar labels.
show_legends (bool, default=True) – If False, suppress generated legends.
hrtf (HRTF)
- Returns:
Figure containing the 3D source grid.
- Return type:
matplotlib.figure.Figure
- Raises:
ValueError – If source positions cannot be resolved as a valid Cartesian grid or axis geometry cannot be computed from the current positions.
Notes
The 3D axes use the same scale on all dimensions, so the plotted grid keeps the physical proportions of the source positions.
Examples
Plot the measurement source grid from a loaded SOFA file:
>>> from hrtfpykit.hrtf import load_hrtf >>> from hrtfpykit.plots import plot_source_grid >>> hrtf = load_hrtf("P0001_FreeFieldComp_44kHz.sofa") >>> plot_source_grid(hrtf)