Visualization¶
Matplotlib, Seaborn and Plotly helpers used by every notebook and Streamlit page: histograms, ECDFs, Q-Q plots, PDF/CDF overlays, bootstrap distributions, Mahalanobis outlier views, loss surfaces, eigenvector plots, interpolation comparisons and confidence-interval charts.
apply_theme(style='whitegrid', palette='Set2', context='notebook', font_scale=1.1)
¶
Apply a global Seaborn theme for consistent plot styling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
style
|
str
|
Seaborn style: 'whitegrid', 'darkgrid', 'white', 'dark', or 'ticks'. |
'whitegrid'
|
palette
|
str
|
Color palette name (any valid Seaborn or Matplotlib palette). |
'Set2'
|
context
|
str
|
Scaling context: 'paper', 'notebook', 'talk', or 'poster'. |
'notebook'
|
font_scale
|
float
|
Scaling factor for all font elements. |
1.1
|
Source code in utils/viz_utils.py
plot_histograms(df, columns, bins=30, title=None, figsize=(12, 6), palette='Set2')
¶
Plot side-by-side histograms with KDE overlays for multiple columns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Input DataFrame. |
required |
columns
|
list of str
|
Column names to plot. |
required |
bins
|
int
|
Number of histogram bins. |
30
|
title
|
str
|
Overall figure title. |
None
|
figsize
|
tuple of (int, int)
|
Figure dimensions. |
(12, 6)
|
palette
|
str
|
Seaborn color palette name. |
'Set2'
|
Returns:
| Type | Description |
|---|---|
Figure
|
Figure object for saving or further customization. |
Source code in utils/viz_utils.py
plot_boxplots(df, columns, title=None, figsize=(8, 5), palette='Set2')
¶
Plot a combined boxplot for multiple columns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Input DataFrame. |
required |
columns
|
list of str
|
Columns to include in the boxplot. |
required |
title
|
str
|
Plot title. Defaults to 'Boxplots'. |
None
|
figsize
|
tuple of (int, int)
|
Figure dimensions. |
(8, 5)
|
palette
|
str
|
Seaborn color palette. |
'Set2'
|
Returns:
| Type | Description |
|---|---|
Figure
|
|
Source code in utils/viz_utils.py
plot_pairplot(df, hue=None, diag_kind='kde', palette='Spectral')
¶
Create a Seaborn pairplot to visualize pairwise relationships.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Input DataFrame with numeric columns. |
required |
hue
|
str
|
Column name for color grouping. |
None
|
diag_kind
|
str
|
Type of plot for diagonal: 'kde' or 'hist'. |
'kde'
|
palette
|
str
|
Color palette for hue groupings. |
'Spectral'
|
Returns:
| Type | Description |
|---|---|
PairGrid
|
PairGrid object containing the pairplot. |
Source code in utils/viz_utils.py
plot_correlation_heatmap(df, annot=True, cmap='coolwarm')
¶
Plot a correlation heatmap for all numeric columns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Input DataFrame. |
required |
annot
|
bool
|
Whether to annotate each cell with the correlation value. |
True
|
cmap
|
str
|
Colormap for the heatmap. |
'coolwarm'
|
Returns:
| Type | Description |
|---|---|
Figure
|
|
Source code in utils/viz_utils.py
save_and_show_plot(fig, filename)
¶
Save a matplotlib figure to disk and display it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fig
|
Figure
|
Figure to save. |
required |
filename
|
str
|
File path to save (e.g., 'output/plot.png'). Format is inferred from extension. |
required |
Source code in utils/viz_utils.py
plot_ecdf(df, column, color='darkorange')
¶
Plot the Empirical Cumulative Distribution Function (ECDF) for a column.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Input DataFrame. |
required |
column
|
str
|
Column name to compute ECDF for. |
required |
color
|
str
|
Line/marker color. |
'darkorange'
|
Returns:
| Type | Description |
|---|---|
Figure
|
|
Source code in utils/viz_utils.py
plot_pdf_overlay(data, dist_obj, params, title='PDF Overlay')
¶
Plot a histogram with a fitted distribution PDF overlaid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
array - like
|
Observed data. |
required |
dist_obj
|
scipy.stats continuous_rv_generic
|
Fitted distribution object. |
required |
params
|
tuple
|
Fitted distribution parameters. |
required |
title
|
str
|
Plot title. |
'PDF Overlay'
|
Returns:
| Type | Description |
|---|---|
Figure
|
|
Source code in utils/viz_utils.py
plot_cdf_overlay(data, dist_obj, params, title='CDF vs ECDF')
¶
Plot the Empirical CDF alongside the theoretical CDF of a fitted distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
array - like
|
Observed data. |
required |
dist_obj
|
scipy.stats continuous_rv_generic
|
Fitted distribution object. |
required |
params
|
tuple
|
Fitted distribution parameters. |
required |
title
|
str
|
Plot title. |
'CDF vs ECDF'
|
Returns:
| Type | Description |
|---|---|
Figure
|
|
Source code in utils/viz_utils.py
plot_covariance_heatmap(df, title='Covariance Matrix')
¶
Plots a fancy covariance heatmap with improved styling and color palette.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Input DataFrame containing numerical columns. |
required |
title
|
str
|
Plot title. |
'Covariance Matrix'
|
Returns:
| Name | Type | Description |
|---|---|---|
fig |
Figure
|
Heatmap figure object for saving or further customization. |
Source code in utils/viz_utils.py
plot_violin_swarm(df, x_col, y_col, title='Violin + Swarm', figsize=(7, 5), palette='Set2')
¶
Create a combined violin + swarm plot for distribution visualization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Input DataFrame. |
required |
x_col
|
str
|
Categorical column for x-axis grouping. |
required |
y_col
|
str
|
Numeric column for y-axis values. |
required |
title
|
str
|
Plot title. |
'Violin + Swarm'
|
figsize
|
tuple of (int, int)
|
Figure dimensions. |
(7, 5)
|
palette
|
str
|
Color palette for violins. |
'Set2'
|
Returns:
| Type | Description |
|---|---|
Figure
|
|
Source code in utils/viz_utils.py
plot_ranked_barplots(x_ranked, y_ranked, title1='x_ranked', title2='y_ranked', figsize=(12, 5))
¶
Plot side-by-side frequency bar charts for two ranked (e.g., Likert-scale) datasets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_ranked
|
array - like
|
First ranked dataset (ordinal / Likert scale values). |
required |
y_ranked
|
array - like
|
Second ranked dataset. |
required |
title1
|
str
|
Title for left subplot. |
'x_ranked'
|
title2
|
str
|
Title for right subplot. |
'y_ranked'
|
figsize
|
tuple of (int, int)
|
Figure dimensions. |
(12, 5)
|
Returns:
| Type | Description |
|---|---|
Figure
|
|
Source code in utils/viz_utils.py
plot_ranked_boxplot(x_ranked, y_ranked, figsize=(7, 5), title='Boxplot of Ranked Distributions')
¶
Plot a side-by-side boxplot for two ranked datasets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_ranked
|
array - like
|
First ranked dataset. |
required |
y_ranked
|
array - like
|
Second ranked dataset. |
required |
figsize
|
tuple of (int, int)
|
Figure dimensions. |
(7, 5)
|
title
|
str
|
Plot title. |
'Boxplot of Ranked Distributions'
|
Returns:
| Type | Description |
|---|---|
Figure
|
|
Source code in utils/viz_utils.py
plot_multi_distribution_overlay(data, distribution_list, title='Multi-Distribution Fit', bins=40)
¶
Plot histogram of data and overlay PDFs of multiple fitted distributions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
array - like
|
Observed data. |
required |
distribution_list
|
list of scipy.stats continuous_rv_generic
|
List of distribution objects to fit and overlay. |
required |
title
|
str
|
Plot title. |
'Multi-Distribution Fit'
|
bins
|
int
|
Number of histogram bins. |
40
|
Returns:
| Type | Description |
|---|---|
Figure
|
|
Source code in utils/viz_utils.py
plot_ecdf_comparison_multi(ecdf_data, title='ECDF Comparison', figsize=None, palette=None)
¶
Plot ECDF curves for multiple datasets on a single figure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ecdf_data
|
dict
|
Dictionary of the form {label: (x_values, y_values)}. |
required |
title
|
str
|
Plot title. |
'ECDF Comparison'
|
figsize
|
tuple of (int, int)
|
Figure size. Defaults to adaptive size based on dataset count. |
None
|
palette
|
list of colors
|
List of colors to use for each dataset. Defaults to Seaborn 'husl'. |
None
|
Returns:
| Type | Description |
|---|---|
Figure
|
|
Source code in utils/viz_utils.py
plot_sampling_distributions(samples_dict, title='Sampling Distributions Comparison', bins=20, figsize=(12, 6), colors=None)
¶
Plot multiple sampling distributions overlaid as density histograms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
samples_dict
|
dict
|
Dictionary of the form {'label': sample_array}. |
required |
title
|
str
|
Plot title. |
'Sampling Distributions Comparison'
|
bins
|
int
|
Number of histogram bins. |
20
|
figsize
|
tuple of (int, int)
|
Figure dimensions. |
(12, 6)
|
colors
|
list
|
List of colors per sample. Defaults to Seaborn 'Set2' palette. |
None
|
Returns:
| Type | Description |
|---|---|
Figure
|
|
Source code in utils/viz_utils.py
plot_bootstrap_distribution(estimates, ci_bounds=None, true_stat=None, title='Bootstrap Distribution', bins=30)
¶
Plot bootstrap distribution with CI bounds and true statistic highlighted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
estimates
|
array - like
|
Bootstrap sample estimates (e.g., bootstrap means). |
required |
ci_bounds
|
tuple of (float, float)
|
(lower, upper) confidence interval bounds to highlight. |
None
|
true_stat
|
float
|
The original sample statistic to mark with a vertical line. |
None
|
title
|
str
|
Plot title. |
'Bootstrap Distribution'
|
bins
|
int
|
Number of histogram bins. |
30
|
Returns:
| Type | Description |
|---|---|
Figure
|
|
Source code in utils/viz_utils.py
plot_mahalanobis_outliers(df, x_col='X1', y_col='X2', outlier_col='is_outlier', title='Mahalanobis Outliers Highlighted', figsize=(7, 5), cmap=None, alpha=0.7)
¶
Scatter plot highlighting Mahalanobis outliers with improved color styling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
DataFrame containing the variables to plot and the outlier flag column. |
required |
x_col
|
str
|
Column name for the x-axis. |
'X1'
|
y_col
|
str
|
Column name for the y-axis. |
'X2'
|
outlier_col
|
str
|
Column name with boolean or 0/1 values marking outliers. |
'is_outlier'
|
title
|
str
|
Plot title. |
'Mahalanobis Outliers Highlighted'
|
figsize
|
tuple
|
Size of the figure. |
(7, 5)
|
cmap
|
str or matplotlib colormap
|
Color map for differentiating outliers vs non-outliers. |
None
|
alpha
|
float
|
Transparency level for scatter points. |
0.7
|
Returns:
| Name | Type | Description |
|---|---|---|
fig |
Figure
|
Figure object for saving or further customization. |
Source code in utils/viz_utils.py
762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 | |
plot_mahalanobis_outliers_3d(df, x_col='X1', y_col='X2', z_col='X3', outlier_col='is_outlier', title='3D Outlier Visualization using Mahalanobis Distance', opacity=0.85, colors=None)
¶
Interactive 3D scatter plot highlighting Mahalanobis outliers with custom colors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
DataFrame containing the 3D coordinates and outlier flag column. |
required |
x_col
|
str
|
Column names for 3D axes. |
'X1'
|
y_col
|
str
|
Column names for 3D axes. |
'X1'
|
z_col
|
str
|
Column names for 3D axes. |
'X1'
|
outlier_col
|
str
|
Column name indicating outliers (boolean or 0/1 values). |
'is_outlier'
|
title
|
str
|
Plot title. |
'3D Outlier Visualization using Mahalanobis Distance'
|
opacity
|
float
|
Transparency level of points. |
0.85
|
colors
|
dict
|
Custom color mapping for outliers vs non-outliers. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
fig |
Figure
|
Interactive Plotly figure for 3D visualization. |
Source code in utils/viz_utils.py
plot_mahalanobis_distance_distribution(df, distance_col='mahalanobis', threshold=None, title='Mahalanobis Distance Distribution')
¶
Plots the distribution of Mahalanobis distances with enhanced colors and threshold annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
DataFrame containing Mahalanobis distances. |
required |
distance_col
|
str
|
Column name with computed Mahalanobis distances. |
'mahalanobis'
|
threshold
|
float
|
Chi-square threshold for marking potential outliers. |
None
|
title
|
str
|
Plot title. |
'Mahalanobis Distance Distribution'
|
Returns:
| Name | Type | Description |
|---|---|---|
fig |
Figure
|
Figure object for saving or further customization. |
Source code in utils/viz_utils.py
plot_3d_loss_surface(X, Y, Z, optimum=None, title='Loss Surface 3D')
¶
Plots 3D loss surface with optional optimal solution marker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Grid coordinates and cost values |
required |
Y
|
ndarray
|
Grid coordinates and cost values |
required |
Z
|
ndarray
|
Grid coordinates and cost values |
required |
optimum
|
tuple(x, y, z)
|
Coordinates of the optimum point to mark on the plot |
None
|
title
|
str
|
Plot title |
'Loss Surface 3D'
|
Source code in utils/viz_utils.py
plot_contour_loss_surface(X, Y, Z, optimum=None, title='Loss Surface Contour')
¶
Plots 2D contour map of a loss surface with optimum point highlighted.
Source code in utils/viz_utils.py
plot_eigenvectors(matrix, eigenvalues, eigenvectors, title='Eigenvectors Visualization')
¶
Plot eigenvectors on a 2D grid with scaling according to eigenvalues.
Source code in utils/viz_utils.py
plot_singular_values(singular_values, title='Singular Values')
¶
Plot singular values from SVD as a bar chart.
Source code in utils/viz_utils.py
plot_least_squares_fit(x_values, observed, predicted, title='Least Squares Fit', figsize=(5, 4), observed_color='blue', predicted_color='red')
¶
Plot observed data points and the fitted line from least squares regression.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_values
|
array - like
|
Independent variable values (x-axis). |
required |
observed
|
array - like
|
Observed dependent variable values. |
required |
predicted
|
array - like
|
Predicted dependent variable values from least squares solution. |
required |
title
|
str
|
Plot title. |
"Least Squares Fit"
|
figsize
|
tuple
|
Size of the figure. |
(5, 4)
|
observed_color
|
str
|
Color for observed points. |
'blue'
|
predicted_color
|
str
|
Color for fitted line. |
'red'
|
Returns:
| Name | Type | Description |
|---|---|---|
fig |
Figure
|
The generated plot figure. |
Source code in utils/viz_utils.py
1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 | |
plot_least_squares_residuals(x_values, residuals, title='Residuals of Least Squares Fit')
¶
Plot residuals for a least squares fit using a stem plot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_values
|
array - like
|
The x-values corresponding to residuals. |
required |
residuals
|
array - like
|
The residuals (observed - predicted) to plot. |
required |
title
|
str
|
Plot title. |
'Residuals of Least Squares Fit'
|
Returns:
| Name | Type | Description |
|---|---|---|
fig |
Figure
|
Figure object for further manipulation or display. |
Source code in utils/viz_utils.py
plot_interpolation_comparison(x, y, x_new, y_lin, y_cub, y_spl, title='Interpolation Comparison', figsize=(10, 6))
¶
Plot comparison of Linear, Cubic, and Spline interpolation.
Source code in utils/viz_utils.py
plot_curve_fits_with_bands(x, y, x_new, y_exp_pred, y_exp_lower, y_exp_upper, y_gauss, title='Curve Fitting with Confidence Bands', figsize=(10, 6))
¶
Plot Exponential and Gaussian curve fits with confidence bands for Exponential.
Source code in utils/viz_utils.py
plot_multivariate_griddata(grid_x, grid_y, grid_z, title='2D Multivariate Interpolation using griddata', cmap='viridis', figsize=(8, 6))
¶
Plot 2D multivariate interpolation results from griddata.
Source code in utils/viz_utils.py
plot_rbf_interpolation(grid_x, grid_y, z_rbf, title='2D RBF Interpolation', cmap='plasma', figsize=(8, 6))
¶
Plot 2D Radial Basis Function interpolation results.
Source code in utils/viz_utils.py
plot_gaussian_fit_with_band(x, y, x_new, y_pred, y_lower, y_upper, title='Gaussian Curve Fit with Confidence Band', figsize=(10, 6))
¶
Plot Gaussian fit with ±2σ confidence band.
Source code in utils/viz_utils.py
plot_polynomial_fit(x, y, x_new, y_poly, degree=2, title='Polynomial Curve Fit', figsize=(10, 6))
¶
Plot polynomial fit alongside original data.
Source code in utils/viz_utils.py
plot_all_fits_comparison(x, y, x_new, y_lin, y_cub, y_spl, y_exp, y_gauss, y_poly, figsize=(10, 6), title='All Fits Overlay Comparison')
¶
Plot all interpolation and curve fitting results on one figure for visual comparison.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
array - like
|
Original data points. |
required |
y
|
array - like
|
Original data points. |
required |
x_new
|
array - like
|
Range of new x-values for prediction. |
required |
y_lin
|
array - like
|
Predicted values from each fit. |
required |
y_cub
|
array - like
|
Predicted values from each fit. |
required |
y_spl
|
array - like
|
Predicted values from each fit. |
required |
y_exp
|
array - like
|
Predicted values from each fit. |
required |
y_gauss
|
array - like
|
Predicted values from each fit. |
required |
y_poly
|
array - like
|
Predicted values from each fit. |
required |
Source code in utils/viz_utils.py
plot_residuals_comparison(x, residual_exp, residual_gauss, residual_poly, residual_weighted, figsize=(10, 6), title='Residuals Comparison')
¶
Plot residuals for multiple fitted models to compare error distributions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
array - like
|
Original x-values. |
required |
residual_exp
|
array - like
|
Residuals for exponential, gaussian, polynomial, and weighted exponential fits. |
required |
residual_gauss
|
array - like
|
Residuals for exponential, gaussian, polynomial, and weighted exponential fits. |
required |
residual_poly
|
array - like
|
Residuals for exponential, gaussian, polynomial, and weighted exponential fits. |
required |
residual_weighted
|
array - like
|
Residuals for exponential, gaussian, polynomial, and weighted exponential fits. |
required |
figsize
|
tuple
|
Figure size for the plot. |
(10, 6)
|
title
|
str
|
Plot title. |
"Residuals Comparison"
|
Returns:
| Name | Type | Description |
|---|---|---|
fig |
Figure
|
The generated residual comparison plot. |
Source code in utils/viz_utils.py
plot_weighted_vs_unweighted_fit(x, y, x_new, y_unweighted, y_weighted, figsize=(10, 6), title='Weighted vs Unweighted Exponential Fit')
¶
Compare weighted and unweighted exponential curve fitting visually.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
array - like
|
Original data points. |
required |
y
|
array - like
|
Original data points. |
required |
x_new
|
array - like
|
Range for prediction. |
required |
y_unweighted
|
array - like
|
Predicted values from unweighted and weighted fits. |
required |
y_weighted
|
array - like
|
Predicted values from unweighted and weighted fits. |
required |
Source code in utils/viz_utils.py
plot_multivariate_error_heatmap(grid_x, grid_y, error_grid, figsize=(8, 6), title='Interpolation Error Heatmap')
¶
Plot error distribution for 2D interpolation as a heatmap.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid_x
|
2D arrays
|
Grid coordinates. |
required |
grid_y
|
2D arrays
|
Grid coordinates. |
required |
error_grid
|
2D array
|
Absolute errors between true and interpolated values. |
required |
Source code in utils/viz_utils.py
plot_confidence_interval(mean, ci, pop_mean=None, figsize=(6, 4), title='Confidence Interval for Sample Mean')
¶
Plot a confidence interval for a sample mean with optional population mean reference line.
mean : float Sample mean ci : tuple Confidence interval (low, high) pop_mean : float, optional Population mean to mark with a reference line figsize : tuple Size of the plot title : str Title of the plot
fig : matplotlib.figure.Figure The generated figure object
Source code in utils/viz_utils.py
plot_residuals_vs_population(sample_mean, pop_mean, residual, figsize=(6, 4))
¶
Plot residual difference between sample mean and population mean.
Source code in utils/viz_utils.py
plot_multiple_confidence_intervals(mean, ci_dict, figsize=(7, 5))
¶
Plot multiple confidence intervals for various confidence levels.
Source code in utils/viz_utils.py
plot_scalar_function(func, x_range=(-10, 10), optimum=None, title='Scalar Function')
¶
Plot a scalar cost function over a given range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
callable
|
The scalar function to plot. |
required |
x_range
|
tuple
|
Range of x values to plot. |
(-10, 10)
|
optimum
|
tuple
|
(x_opt, y_opt) location of optimum, optional. |
None
|
title
|
str
|
Title of the plot. |
'Scalar Function'
|
Source code in utils/viz_utils.py
plot_residuals(predicted, actual, figsize=(6, 4))
¶
Simple wrapper to plot residuals (Predicted - Actual).
Source code in utils/viz_utils.py
plot_singular_values_safe(singular_values, title='Singular Values (Safe Plot)')
¶
A safe version of plot_singular_values that: - Converts input to numeric floats - Handles lists, Series, or arrays with mixed types - Plots without breaking due to dtype issues
Source code in utils/viz_utils.py
plot_eigenvectors_safe(matrix, eigvals, eigvecs, title='Eigenvectors Visualization')
¶
Plots eigenvectors safely in 2D space. If matrix dimension > 2, only the first 2 components are plotted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
ndarray
|
Original matrix (for scale reference) |
required |
eigvals
|
array - like
|
Eigenvalues |
required |
eigvecs
|
array - like
|
Eigenvectors |
required |
Returns:
| Name | Type | Description |
|---|---|---|
fig |
Figure
|
|