pyphi.plots module¶
Plots for pyPhi
@author: Sal Garcia <sgarciam@ic.ac.uk> <salvadorgarciamunoz@gmail.com>
- Changes on Feb 25th 2026:
Bokeh 3.x: tooltips removed from figure(); now added via explicit HoverTool
Extracted shared helpers: _get_lv_labels, _get_xvar_labels, _get_yvar_labels, _new_output_file, _make_bokeh_palette, _resolve_lpls_space, _mask_by_class, _add_hover
Fixed loop-variable collision in predvsobs (i → j)
Fixed output_file inside loop in mb_r2pb
Fixed 2-D y_ array in score_line (.flatten())
Fixed nan_policy on vbar (not supported); use per-series ColumnDataSource
Fixed bitwise ~ on bool in lineplot
Added unbound-variable guard in contributions_plot
Replaced False sentinels with None throughout
Replaced list(np.arange(…)+1) with range(1, n+1)
Replaced string concatenation with f-strings
Standardised colormap keyword args (alpha=1, bytes=True)
Replaced math.pi with np.pi
loadings / weighted_loadings: PLS now produces single HTML with X (blue) and Y (red) bars on a shared axis per LV
- pyphi.plots.r2pv(mvm_obj: dict, *, plotwidth: int = 600, plotheight: int = 400, addtitle: str = '', material=None, zspace: bool = False) None[source]¶
Plot R² per variable per latent variable / principal component.
Produces a stacked bar chart where each bar represents a variable and each colour band represents the contribution of one LV/PC to that variable’s explained variance. For PLS models, X and Y plots are shown stacked vertically in a single HTML file.
- Parameters:
mvm_obj (dict) – Fitted model from
pyphi.pca(),pyphi.pls(),pyphi.lpls(),pyphi.jrpls(), orpyphi.tpls().plotwidth (int) – Width of each plot in pixels. Default
600.plotheight (int) – Height of each plot in pixels. Default
400.addtitle (str) – Optional string appended to the plot title. Default
"".material (str) – For JRPLS / TPLS models, the name of the material block to display. If
None, the R-space (blend) loadings are used. DefaultNone.zspace (bool) – For TPLS models, if
Trueplots the Z-space (trajectory) R² instead of the X-space R². DefaultFalse.
- Returns:
Saves and opens an HTML file via Bokeh’s
show().- Return type:
None
- pyphi.plots.loadings(mvm_obj: dict, *, plotwidth: int = 750, xgrid: bool = False, addtitle: str = '', material=None, zspace: bool = False, ScaleToPlot: bool = False) None[source]¶
Plot model loadings as vertical bar charts, one chart per LV/PC.
For PCA models: each chart shows X-space loadings (P or W*) in blue.
For PLS models: each chart shows X-space loadings (W*) in blue and Y-space loadings (Q) in red on a shared categorical axis, separated by a vertical dashed divider. Without
ScaleToPlot, a dual y-axis is used so both X and Y loadings are readable regardless of scale differences. WithScaleToPlot, both are normalised to [-1, 1] and share a single y-axis.All charts are written to a single HTML file.
- Parameters:
mvm_obj (dict) – Fitted model from
pyphi.pca(),pyphi.pls(),pyphi.lpls(),pyphi.jrpls(), orpyphi.tpls().plotwidth (int) – Width of each chart in pixels. Default
750.xgrid (bool) – If
True, show vertical grid lines. DefaultFalse.addtitle (str) – Optional string appended to each chart title. Default
"".material (str) – For JRPLS / TPLS models, the material block to plot. Default
None(uses R-space / blend loadings).zspace (bool) – For TPLS models, if
Trueplots Z-space (trajectory) loadings. DefaultFalse.ScaleToPlot (bool) – If
True, normalises each loading vector to [-1, 1] before plotting, so all LVs are visually comparable. DefaultFalse.
- Returns:
Saves and opens an HTML file via Bokeh’s
show().- Return type:
None
- pyphi.plots.loadings_map(mvm_obj: dict, dims: list[int], *, plotwidth: int = 600, addtitle: str = '', material=None, zspace: bool = False, textalpha: float = 0.75) None[source]¶
Scatter plot of loadings on two selected components (loadings map / biplot).
For PLS models, X-space loadings (W*, blue) and Y-space loadings (Q, red) are overlaid on a normalised [-1, 1] axis, making it easy to identify which X variables co-vary with which Y variables. For PCA models, only P loadings are shown.
- Parameters:
mvm_obj (dict) – Fitted model from
pyphi.pca(),pyphi.pls(),pyphi.lpls(),pyphi.jrpls(), orpyphi.tpls().dims (list[int]) – Two component indices to plot, e.g.
[1, 2]for the first two LVs/PCs (1-indexed).plotwidth (int) – Width of the plot in pixels. Default
600.addtitle (str) – Optional string appended to the plot title. Default
"".material (str) – For JRPLS / TPLS, the material block to use. Default
None.zspace (bool) – For TPLS, if
Trueuses Z-space loadings. DefaultFalse.textalpha (float) – Transparency of variable name labels (0–1). Default
0.75.
- Returns:
Saves and opens an HTML file via Bokeh’s
show().- Return type:
None
- pyphi.plots.weighted_loadings(mvm_obj: dict, *, plotwidth: int = 750, xgrid: bool = False, addtitle: str = '', material=None, zspace: bool = False, ScaleToPlot: bool = False) None[source]¶
Plot loadings weighted by their R² contribution, one chart per LV/PC.
Each loading coefficient is multiplied by the corresponding per-variable R² value, so variables that explain more variance appear larger. This helps identify truly important variables vs. those that load highly but explain little variance.
For PCA models: shows
P × R²X(blue).For PLS models: shows
W* × R²X(blue, left axis) andQ × R²Y(red, right axis) on a shared categorical axis with a dual y-axis layout (or single normalised axis withScaleToPlot).All charts are written to a single HTML file.
- Parameters:
mvm_obj (dict) – Fitted model from
pyphi.pca(),pyphi.pls(),pyphi.lpls(),pyphi.jrpls(), orpyphi.tpls().plotwidth (int) – Width of each chart in pixels. Default
750.xgrid (bool) – If
True, show vertical grid lines. DefaultFalse.addtitle (str) – Optional string appended to each chart title. Default
"".material (str) – For JRPLS / TPLS, the material block to plot. Default
None.zspace (bool) – For TPLS, if
Trueplots Z-space weighted loadings. DefaultFalse.ScaleToPlot (bool) – If
True, normalises loadings to [-1, 1] before weighting, placing X and Y on a single shared axis. DefaultFalse.
- Returns:
Saves and opens an HTML file via Bokeh’s
show().- Return type:
None
- pyphi.plots.vip(mvm_obj: dict, *, plotwidth: int = 600, material=None, zspace: bool = False, addtitle: str = '') None[source]¶
Plot Variable Importance in Projection (VIP) scores.
VIP summarises the contribution of each X variable across all LVs, weighted by the R²Y explained by each LV. Variables are sorted from highest to lowest VIP. Only applicable to PLS models (silently returns for PCA models).
- Parameters:
mvm_obj (dict) – Fitted PLS model from
pyphi.pls(),pyphi.lpls(),pyphi.jrpls(), orpyphi.tpls().plotwidth (int) – Width of the plot in pixels. Default
600.material (str) – For JRPLS / TPLS, the material block to use. Default
None.zspace (bool) – For TPLS, if
Truecomputes VIP in Z-space. DefaultFalse.addtitle (str) – Optional string appended to the plot title. Default
"".
- Returns:
Saves and opens an HTML file via Bokeh’s
show().- Return type:
None
- pyphi.plots.score_scatter(mvm_obj: dict, xydim: list[int], *, CLASSID: DataFrame | None = None, colorby: str | None = None, Xnew=None, add_ci: bool = False, add_labels: bool = False, add_legend: bool = True, legend_cols: int = 1, addtitle: str = '', plotwidth: int = 600, plotheight: int = 600, rscores: bool = False, material=None, marker_size: int = 7, nbins=None, include_model: bool = False) None[source]¶
Score scatter plot for two selected latent variables or principal components.
Plots training scores (or scores for new observations) on two chosen components. Supports class-based colouring, confidence ellipses, observation labels, and overlaying new observations on top of training data.
- Parameters:
mvm_obj (dict) – Fitted model from
pyphi.pca(),pyphi.pls(),pyphi.lpls(),pyphi.jrpls(), orpyphi.tpls().xydim (list[int]) – Two component indices to plot, e.g.
[1, 2](1-indexed).CLASSID (pd.DataFrame) – Optional class-membership DataFrame. First column should be observation IDs;
colorbyspecifies the column to colour by. DefaultNone.colorby (str) – Column name in
CLASSIDto use for colouring. Required ifCLASSIDis provided. DefaultNone.Xnew (pd.DataFrame or np.ndarray) – New observations to project and plot. If
None, training scores are used. Not supported for LPLS / JRPLS models. DefaultNone.add_ci (bool) – If
True, overlays 95% (gold) and 99% (red) confidence ellipses. DefaultFalse.add_labels (bool) – If
True, annotates each point with its observation ID. DefaultFalse.add_legend (bool) – If
TrueandCLASSIDis provided, adds a click-to-hide legend. DefaultTrue.legend_cols (int) – Number of legend columns when using
CLASSID. Default1.addtitle (str) – Optional string appended to the plot title. Default
"".plotwidth (int) – Width of the plot in pixels. Default
600.plotheight (int) – Height of the plot in pixels. Default
600.rscores (bool) – For LPLS / JRPLS / TPLS models, if
Trueplots R-space scores instead of X-space scores. DefaultFalse.material (str) – For JRPLS / TPLS, the material block to plot when
rscores=True. DefaultNone(plots all materials, coloured by material name).marker_size (int) – Marker size in pixels. Default
7.nbins (int) – If provided, bins a continuous
colorbyvariable intonbinsgroups before colouring. DefaultNone.include_model (bool) – If
TrueandXnewis provided, overlays training set scores (grey, labelled “Model”) alongside the new observations. DefaultFalse.
- Returns:
Saves and opens an HTML file via Bokeh’s
show().- Return type:
None
- pyphi.plots.score_line(mvmobj: dict, dim, *, CLASSID: DataFrame | None = None, colorby: str | None = None, Xnew=None, add_ci: bool = False, add_labels: bool = False, add_legend: bool = True, plotline: bool = True, plotwidth: int = 600, plotheight: int = 600) None[source]¶
Score line plot: one component plotted against observation sequence.
Useful for monitoring or batch data where the observation order is meaningful. When
CLASSIDis provided, markers are coloured by class with a single grey connecting line underneath.- Parameters:
mvmobj (dict) – Fitted model from
pyphi.pca()orpyphi.pls().dim (int or list[int]) – Component index to plot (1-indexed). Pass a single integer or a one-element list, e.g.
1or[1].CLASSID (pd.DataFrame) – Optional class-membership DataFrame. First column is observation IDs;
colorbyspecifies the column used for colouring. DefaultNone.colorby (str) – Column name in
CLASSIDto colour by. Required ifCLASSIDis provided. DefaultNone.Xnew (pd.DataFrame or np.ndarray) – New observations to project and plot. If
None, training scores are used. DefaultNone.add_ci (bool) – If
True, overlays 95% (gold) and 99% (red) univariate confidence limits as dashed horizontal lines. DefaultFalse.add_labels (bool) – If
True, annotates each point with its observation ID. DefaultFalse.add_legend (bool) – If
TrueandCLASSIDis provided, adds a click-to-hide legend. DefaultTrue.plotline (bool) – If
True, draws a line connecting the observations in sequence. DefaultTrue.plotwidth (int) – Width of the plot in pixels. Default
600.plotheight (int) – Height of the plot in pixels. Default
600.
- Returns:
Saves and opens an HTML file via Bokeh’s
show().- Return type:
None
- pyphi.plots.diagnostics(mvmobj: dict, *, Xnew=None, Ynew=None, score_plot_xydim=None, plotwidth: int = 600, ht2_logscale: bool = False, spe_logscale: bool = False) None[source]¶
Hotelling’s T² and SPE diagnostic dashboard.
Produces a column of linked plots:
Hotelling’s T² vs. observation sequence, with 95% (gold) and 99% (red) control limits.
SPE X-space vs. observation sequence, with control limits.
Outlier map: T² vs. SPE X, with 99% limits as crosshairs.
SPE Y-space (PLS models only, when
Ynewis supplied or using training data).Score scatter (optional, if
score_plot_xydimis provided).
- Parameters:
mvmobj (dict) – Fitted model from
pyphi.pca()orpyphi.pls().Xnew (pd.DataFrame or np.ndarray) – New X observations to diagnose. If
None, training set diagnostics are plotted. DefaultNone.Ynew (pd.DataFrame or np.ndarray) – New Y observations (optional). Used only for PLS models to compute Y-space SPE. Default
None.score_plot_xydim (list[int]) – If provided (e.g.
[1, 2]), appends a score scatter plot for the specified components, with confidence ellipses overlaid. DefaultNone.plotwidth (int) – Width of each plot in pixels. Default
600.ht2_logscale (bool) – If
True, plots Hotelling’s T² on a log₁₀ scale. DefaultFalse.spe_logscale (bool) – If
True, plots SPE X on a log₁₀ scale. DefaultFalse.
- Returns:
Saves and opens an HTML file via Bokeh’s
show().- Return type:
None
- pyphi.plots.predvsobs(mvmobj: dict, X, Y, *, CLASSID: DataFrame | None = None, colorby: str | None = None, x_space: bool = False) None[source]¶
Observed vs. predicted scatter plots for all Y (and optionally X) variables.
One square scatter plot is produced per variable, with a 45° reference line (cyan, dashed). All plots are stacked vertically in a single HTML file.
- Parameters:
mvmobj (dict) – Fitted model from
pyphi.pca()orpyphi.pls().X (pd.DataFrame, np.ndarray, or dict) – Predictor data. For multi-block models pass a dict of DataFrames keyed by block name.
Y (pd.DataFrame or np.ndarray) – Observed response values. Must have the same number of rows as
X.CLASSID (pd.DataFrame) – Optional class-membership DataFrame for colouring points. First column is observation IDs. Default
None.colorby (str) – Column in
CLASSIDto use for colouring. Required ifCLASSIDis provided. DefaultNone.x_space (bool) – If
True, also plots observed vs. predicted for each X variable (X-space reconstruction). For PCA models this is alwaysTrue. DefaultFalse.
- Returns:
Saves and opens an HTML file via Bokeh’s
show().- Return type:
None
- pyphi.plots.contributions_plot(mvmobj: dict, X, cont_type: str, *, Y=False, from_obs=None, to_obs=None, lv_space=False, plotwidth: int = 800, plotheight: int = 600, xgrid: bool = False) None[source]¶
Bar chart of variable contributions to a monitoring statistic.
Shows how much each variable contributes to the T², SPE, or score of a specific observation (or the difference between two observations). For SPE with PLS models, separate X and Y contribution bars are shown.
- Parameters:
mvmobj (dict) – Fitted model from
pyphi.pca()orpyphi.pls().X (pd.DataFrame, np.ndarray, or dict) – Data containing the observation(s) to diagnose. For multi-block models, pass a dict of DataFrames.
cont_type (str) – Type of contribution to compute and plot.
'scores': contribution to each latent variable score.'spe': contribution to SPE (X and, for PLS, Y).'t2': contribution to Hotelling’s T².Y (pd.DataFrame or np.ndarray) – Y data. Required for
cont_type='spe'with a PLS model. DefaultFalse(not provided).from_obs (int, str, or list) – Reference observation for difference-based contributions. Can be an integer index, an observation ID string, or a list thereof. If
None, contributions are computed absolutely forto_obs. DefaultNone.to_obs (int, str, or list) – The observation(s) to diagnose. Can be an integer index, observation ID string, or list thereof. This argument is required. Default
None.lv_space (bool) – If
True, computes contributions in latent variable space. DefaultFalse.plotwidth (int) – Width of the plot in pixels. Default
800.plotheight (int) – Height of the plot in pixels. Default
600.xgrid (bool) – If
True, shows vertical grid lines. DefaultFalse.
- Returns:
Saves and opens an HTML file via Bokeh’s
show().- Return type:
None
- pyphi.plots.mb_weights(mvmobj: dict, *, plotwidth: int = 600, plotheight: int = 400) None[source]¶
Bar chart of super-weights (block weights) for a Multi-Block PLS model.
Shows the weight of each X block on each latent variable, indicating which blocks drive the model. One bar chart is produced per LV, stacked vertically in a single HTML file.
- Parameters:
mvmobj (dict) – Fitted MBPLS model from
pyphi.mbpls(). Must contain the'Wt'(super-weights) and'Xblocknames'keys.plotwidth (int) – Width of each plot in pixels. Default
600.plotheight (int) – Height of each plot in pixels. Default
400.
- Returns:
Saves and opens an HTML file via Bokeh’s
show().- Return type:
None
- pyphi.plots.mb_r2pb(mvmobj: dict, *, plotwidth: int = 600, plotheight: int = 400) None[source]¶
Stacked bar chart of R² per block per LV for a Multi-Block PLS model.
Each bar represents an X block; colour bands show the contribution of each LV to that block’s explained variance.
- Parameters:
mvmobj (dict) – Fitted MBPLS model from
pyphi.mbpls(). Must contain the'r2pbX'and'Xblocknames'keys.plotwidth (int) – Width of the plot in pixels. Default
600.plotheight (int) – Height of the plot in pixels. Default
400.
- Returns:
Saves and opens an HTML file via Bokeh’s
show().- Return type:
None
- pyphi.plots.mb_vip(mvmobj: dict, *, plotwidth: int = 600, plotheight: int = 400) None[source]¶
Bar chart of block-level VIP scores for a Multi-Block PLS model.
Computes a VIP score for each X block (using block super-weights and R²Y per LV) and displays them sorted from highest to lowest.
- Parameters:
mvmobj (dict) – Fitted MBPLS model from
pyphi.mbpls(). Must contain the'Wt','r2y', and'Xblocknames'keys.plotwidth (int) – Width of the plot in pixels. Default
600.plotheight (int) – Height of the plot in pixels. Default
400.
- Returns:
Saves and opens an HTML file via Bokeh’s
show().- Return type:
None
- pyphi.plots.barplot(yheights, xtick_labels: list[str], *, plotwidth: int = 600, plotheight: int = 600, addtitle: str = '', xlabel: str = '', ylabel: str = '', tabtitle: str = 'Bar Plot') None[source]¶
Generic vertical bar plot.
A simple utility for plotting any set of values as a bar chart with custom tick labels.
- Parameters:
yheights (list or np.ndarray) – Bar heights (one value per bar).
xtick_labels (list[str]) – Category labels for the x-axis. Length must match
yheights.plotwidth (int) – Width of the plot in pixels. Default
600.plotheight (int) – Height of the plot in pixels. Default
600.addtitle (str) – Plot title. Default
"".xlabel (str) – X-axis label. Default
"".ylabel (str) – Y-axis label. Default
"".tabtitle (str) – Browser tab / HTML file title. Default
"Bar Plot".
- Returns:
Saves and opens an HTML file via Bokeh’s
show().- Return type:
None
- pyphi.plots.lineplot(X, *, ids_2_include=None, x_axis=None, plot_title: str = 'Main Title', tab_title: str = 'Tab Title', xaxis_label: str = 'X-axis', yaxis_label: str = '', plotheight: int = 400, plotwidth: int = 600, legend_cols: int = 1, linecolor: str = 'blue', linewidth: int = 2, add_marker: bool = False, individual_plots: bool = False, add_legend: bool = True, markercolor: str = 'darkblue', markersize: int = 10, fill_alpha: float = 0.2, line_alpha: float = 0.4, ncx_x_col=None, ncx_y_col=None, ncx_id_col=None, CLASSID: DataFrame | None = None, colorby: str | None = None, yaxis_log: bool = False) None[source]¶
Multi-series line plot from a DataFrame or a list of DataFrames.
Supports two input modes:
Common x-axis (
Xis apd.DataFrame): Each selected column is plotted as a separate line against a shared x-axis (either the row index or a customx_axisarray).Non-common x-axis (
Xis a list of DataFrames): Each DataFrame represents one series with its own x-values. Usencx_x_col,ncx_y_col, andncx_id_colto specify the column names for x-values, y-values, and series IDs respectively.- Parameters:
X (pd.DataFrame or list[pd.DataFrame]) – Data to plot.
ids_2_include (list[str] or str) – Column names (common x-axis mode) or series ID values (non-common x-axis mode) to include. If
None, all columns / series are included. DefaultNone.x_axis (list or np.ndarray) – Custom x-axis values for common x-axis mode. If
None, observation sequence numbers are used. DefaultNone.plot_title (str) – Main plot title. Default
"Main Title".tab_title (str) – Browser tab / HTML file title. Default
"Tab Title".xaxis_label (str) – X-axis label. Default
"X-axis".yaxis_label (str) – Y-axis label. Default
"".plotheight (int) – Height of the plot in pixels. Default
400.plotwidth (int) – Width of the plot in pixels. Default
600.legend_cols (int) – Number of side-by-side legend columns. Default
1.linecolor (str) – Line colour when a single
individual_plotsline is drawn. Default"blue".linewidth (int) – Line width in pixels. Default
2.add_marker (bool) – If
True, overlays scatter markers on each line. DefaultFalse.individual_plots (bool) – If
True, produces one separate plot per series stacked vertically. IfFalse, all series are overlaid on a single plot. DefaultFalse.add_legend (bool) – If
True, adds a click-to-hide legend. DefaultTrue.markercolor (str) – Marker fill colour when
add_marker=True. Default"darkblue".markersize (int) – Marker size in pixels. Default
10.fill_alpha (float) – Marker fill transparency (0–1). Default
0.2.line_alpha (float) – Line transparency (0–1). Default
0.4.ncx_x_col (str) – Column name for x-values in non-common x-axis mode. Default
None.ncx_y_col (str) – Column name for y-values in non-common x-axis mode. Default
None.ncx_id_col (str) – Column name used to identify each series in non-common x-axis mode. Default
None.CLASSID (pd.DataFrame) – Optional class-membership DataFrame. First column is series IDs;
colorbyspecifies the column to colour by. Only used in common x-axis mode. DefaultNone.colorby (str) – Column in
CLASSIDto use for colouring. Required ifCLASSIDis provided. DefaultNone.yaxis_log (bool) – If
True, uses a logarithmic y-axis scale. DefaultFalse.
- Returns:
Saves and opens an HTML file via Bokeh’s
show().- Return type:
None
- pyphi.plots.plot_spectra(X, *, xaxis=None, plot_title: str = 'Main Title', tab_title: str = 'Tab Title', xaxis_label: str = 'X-axis', yaxis_label: str = 'Y-axis', linecolor: str = 'blue', linewidth: int = 2) None[source]¶
Plot spectral data: one line per sample (row).
Draws all spectra as a multi-line plot where each row of
Xis a separate spectrum. The x-axis values are taken from the DataFrame column headers (if a DataFrame) or fromxaxis(if an ndarray).- Parameters:
X (pd.DataFrame or np.ndarray) – Spectral matrix (n_samples × n_wavelengths). If a DataFrame, the first column must contain sample IDs and the remaining column headers are used as x-axis tick values.
xaxis (list or np.ndarray) – Custom x-axis values (e.g. wavelengths). Only used when
Xis an ndarray. IfNone, sequential integers are used. DefaultNone.plot_title (str) – Main plot title. Default
"Main Title".tab_title (str) – Browser tab / HTML file title. Default
"Tab Title".xaxis_label (str) – X-axis label (e.g.
"Wavelength (nm)"). Default"X-axis".yaxis_label (str) – Y-axis label (e.g.
"Absorbance"). Default"Y-axis".linecolor (str) – Colour applied to all spectral lines. Default
"blue".linewidth (int) – Line width in pixels. Default
2.
- Returns:
Saves and opens an HTML file via Bokeh’s
show().- Return type:
None
- pyphi.plots.scatter_with_labels(x, y, *, xlabel: str = 'X var', ylabel: str = 'Y var', labels=None, tabtitle: str = 'Scatter Plot', plottitle: str = 'Scatter', legend_cols: int = 1, CLASSID: DataFrame | None = None, colorby: str | None = None, plotwidth: int = 600, plotheight: int = 600, markercolor: str = 'darkblue', markersize: int = 10, fill_alpha: float = 0.2, line_alpha: float = 0.4) None[source]¶
Generic scatter plot with hover labels and optional class colouring.
A flexible utility for plotting any two arrays against each other, with per-point labels shown on hover and optional class-based colouring. Origin lines (x=0, y=0) are added automatically.
- Parameters:
x (list or np.ndarray) – X coordinates of each point.
y (list or np.ndarray) – Y coordinates of each point. Must have the same length as
x.xlabel (str) – X-axis label. Default
"X var".ylabel (str) – Y-axis label. Default
"Y var".labels (list[str]) – Per-point labels shown in the hover tooltip. If
None, points are labelled"Obs 0","Obs 1", etc. DefaultNone.tabtitle (str) – Browser tab / HTML file title. Default
"Scatter Plot".plottitle (str) – Main plot title. Default
"Scatter".legend_cols (int) – Number of side-by-side legend columns when
CLASSIDis used. Default1.CLASSID (pd.DataFrame) – Optional class-membership DataFrame for colouring points. First column is point IDs. Default
None.colorby (str) – Column in
CLASSIDto colour by. Required ifCLASSIDis provided. DefaultNone.plotwidth (int) – Width of the plot in pixels. Default
600.plotheight (int) – Height of the plot in pixels. Default
600.markercolor (str) – Marker colour when no
CLASSIDis provided. Default"darkblue".markersize (int) – Marker size in pixels. Default
10.fill_alpha (float) – Marker fill transparency (0–1). Default
0.2.line_alpha (float) – Marker edge transparency (0–1). Default
0.4.
- Returns:
Saves and opens an HTML file via Bokeh’s
show().- Return type:
None