lsurf.visualization.common
Visualization Common Utilities
Shared styling, color mapping, and helper functions for all visualization modules.
Functions
|
Add colorbar to axes. |
|
Create figure with standard settings. |
|
Create color mapping for values. |
|
Get axis indices and labels for xy/xz/yz projections. |
|
Save figure with standard settings. |
|
Apply standard axis formatting. |
|
Convert wavelength (in meters) to approximate visible color. |
- lsurf.visualization.common.get_color_mapping(values, cmap_name='viridis', vmin=None, vmax=None)[source]
Create color mapping for values.
- Parameters:
- Returns:
colors (ndarray) – RGBA colors for each value.
norm (Normalize) – Normalization object.
sm (ScalarMappable) – ScalarMappable for colorbar.
- Return type:
- lsurf.visualization.common.wavelength_to_color(wavelength_m)[source]
Convert wavelength (in meters) to approximate visible color.
- Parameters:
wavelength_m (float or ndarray) – Wavelength in meters.
- Returns:
color – RGB color tuple(s) in [0, 1] range.
- Return type:
tuple or ndarray
Notes
Uses simplified visible spectrum approximation. Wavelengths outside visible range return gray.
- lsurf.visualization.common.setup_axis_grid(ax, xlabel='', ylabel='', title='', grid=True)[source]
Apply standard axis formatting.
- lsurf.visualization.common.add_colorbar(ax, mappable, label='', orientation='vertical')[source]
Add colorbar to axes.
- lsurf.visualization.common.create_figure(nrows=1, ncols=1, figsize=None, constrained_layout=True, **kwargs)[source]
Create figure with standard settings.
- Parameters:
- Returns:
fig (Figure) – Matplotlib figure.
axes (Axes or ndarray) – Axes object(s).
- Return type:
- lsurf.visualization.common.save_figure(fig, path, dpi=150, bbox_inches='tight', **kwargs)[source]
Save figure with standard settings.