scitex.plt
Figure and Axis Creation
- scitex.plt.subplots(nrows=1, ncols=1, axes_width_mm=None, axes_height_mm=None, margin_left_mm=None, margin_right_mm=None, margin_bottom_mm=None, margin_top_mm=None, space_w_mm=None, space_h_mm=None, style=None, apply_style_mm=True, panel_labels=None, **kwargs)[source]
Create a figure with recording-enabled axes.
This is a drop-in replacement for plt.subplots() that wraps the returned figure and axes with recording capabilities.
Supports mm-based layout control for publication-quality figures.
- Parameters:
nrows (int) – Number of rows and columns of subplots.
ncols (int) – Number of rows and columns of subplots.
axes_width_mm (float, optional) – Axes dimensions in mm.
axes_height_mm (float, optional) – Axes dimensions in mm.
margin_left_mm (float, optional) – Left/right margins in mm.
margin_right_mm (float, optional) – Left/right margins in mm.
margin_bottom_mm (float, optional) – Bottom/top margins in mm.
margin_top_mm (float, optional) – Bottom/top margins in mm.
space_w_mm (float, optional) – Horizontal/vertical spacing between axes in mm.
space_h_mm (float, optional) – Horizontal/vertical spacing between axes in mm.
style (dict, optional) – Style configuration dictionary.
apply_style_mm (bool) – If True (default), apply loaded style to axes.
panel_labels (bool or None) – If True, add panel labels (A, B, C, …).
**kwargs – Additional arguments passed to plt.subplots().
- Return type:
Tuple[RecordingFigure,Union[RecordingAxes,ndarray[tuple[Any,...],dtype[TypeVar(_ScalarT, bound=generic)]]]]- Returns:
fig (RecordingFigure) – Wrapped figure object.
axes (RecordingAxes or ndarray) – Wrapped axes.
- scitex.plt.figure(*args, **kwargs)[source]
Create a new figure with optional recording support.
This is a pass-through to matplotlib.pyplot.figure(). For recording support, use subplots() instead.
- Parameters:
*args – Arguments passed to matplotlib.pyplot.figure().
**kwargs – Arguments passed to matplotlib.pyplot.figure().
- Returns:
The created figure.
- Return type:
Gallery
Demo plotters registry for all supported figrecipe plotting methods.
Usage
>>> from figrecipe._dev.demo_plotters import REGISTRY, create_all_plots_figure
>>>
>>> # List all available plot types
>>> print(list(REGISTRY.keys()))
>>>
>>> # List by category
>>> from figrecipe._dev.demo_plotters import CATEGORIES
>>> for cat, plots in CATEGORIES.items():
... print(f"{cat}: {plots}")
>>>
>>> # Create a single figure with all plot types
>>> fig, axes = create_all_plots_figure(fr)
>>>
>>> # Run individual plotter
>>> fig, ax = REGISTRY['plot'](fr, rng, ax)
- scitex.plt.gallery.generate(output_dir='./gallery', category=None, plot_type=None, dpi=150, save_csv=True, save_png=True, save_svg=True, save_plot=True, verbose=True)[source]
Generate gallery plots (figrecipe bundles + extracted PNG/SVG/CSV).
- Parameters:
output_dir (str or Path) – Output directory for the gallery.
category (str, optional) – Generate only plots in this category (see
gallery.CATEGORIES).plot_type (str, optional) – Generate only this specific plot type.
dpi (int) – Resolution for raster output.
save_csv (bool) – Which artifacts to keep.
save_png (bool) – Which artifacts to keep.
save_svg (bool) – Which artifacts to keep.
save_plot (bool) – Which artifacts to keep.
verbose (bool) – Print progress messages.
- Returns:
Generated file paths and any errors.
- Return type:
- scitex.plt.gallery.get_plot_spec(category, plot_name)[source]
Get a minimal spec dictionary for a gallery plot.
- scitex.plt.gallery.get_plot_data(category, plot_name)[source]
Get sample data for a gallery plot as a DataFrame.
- Parameters:
- Returns:
Sample data for the plot, or None if it has no extractable data.
- Return type:
pandas.DataFrame or None
- scitex.plt.gallery.list_plots_by_category()[source]
List all available plot types organized by category.
- scitex.plt.gallery.get_representative_plots()[source]
Get one representative plot from each category for demos.
- scitex.plt.gallery.create_all_plots_figure(plt, seed=42)[source]
Create a single figure with all supported plot types.
- scitex.plt.gallery.run_individual_demos(plt, output_dir=None, show=False)[source]
Run all demo plotters individually and optionally save outputs.
- scitex.plt.gallery.run_all_demos(plt, output_dir=None, show=False)
Run all demo plotters individually and optionally save outputs.
- scitex.plt.gallery.plot_errorbar(plt, rng, ax=None)[source]
Error bar plot demo with multiple series and legend.
Demonstrates: ax.errorbar() with SCITEX color palette and legend
- scitex.plt.gallery.plot_fill(plt, rng, ax=None)[source]
Filled polygon demo with multiple shapes and legend.
Demonstrates: ax.fill() with SCITEX color palette and legend
- scitex.plt.gallery.plot_fill_between(plt, rng, ax=None)[source]
Filled area between curves demo with multiple regions and legend.
Demonstrates: ax.fill_between() with SCITEX color palette and legend
- scitex.plt.gallery.plot_fill_betweenx(plt, rng, ax=None)[source]
Horizontal filled area demo with multiple regions and legend.
Demonstrates: ax.fill_betweenx() with SCITEX color palette and legend
- scitex.plt.gallery.plot_stackplot(plt, rng, ax=None)[source]
Stacked area plot demo with legend.
Demonstrates: ax.stackplot() with SCITEX color palette and legend
- scitex.plt.gallery.plot_stairs(plt, rng, ax=None)[source]
Staircase plot demo with legend.
Demonstrates: ax.stairs() with SCITEX color palette and legend
- scitex.plt.gallery.plot_step(plt, rng, ax=None)[source]
Step plot demo with multiple series and legend.
Demonstrates: ax.step() with SCITEX color palette and legend
- scitex.plt.gallery.plot_scatter(plt, rng, ax=None)[source]
Scatter plot demo with multiple groups in different colors.
Demonstrates: ax.scatter() with SCITEX color palette and legend
- scitex.plt.gallery.plot_bar(plt, rng, ax=None)[source]
Bar chart demo with grouped bars and legend.
Demonstrates: ax.bar() with SCITEX color palette and legend
- scitex.plt.gallery.plot_barh(plt, rng, ax=None)[source]
Horizontal bar chart demo with grouped bars and legend.
Demonstrates: ax.barh() with SCITEX color palette and legend
- scitex.plt.gallery.plot_boxplot(plt, rng, ax=None)[source]
Box plot demo with different colors for each group and legend.
Demonstrates: ax.boxplot() with SCITEX color palette and legend
- scitex.plt.gallery.plot_ecdf(plt, rng, ax=None)[source]
Empirical CDF demo with multiple distributions and legend.
Demonstrates: ax.ecdf() with SCITEX color palette and legend
- scitex.plt.gallery.plot_hist(plt, rng, ax=None)[source]
Histogram demo with multiple distributions and legend.
Demonstrates: ax.hist() with SCITEX color palette and legend
- scitex.plt.gallery.plot_hist2d(plt, rng, ax=None)[source]
2D histogram demo.
Demonstrates: ax.hist2d()
- scitex.plt.gallery.plot_violinplot(plt, rng, ax=None)[source]
Violin plot demo with colors for each group and legend.
Demonstrates: ax.violinplot() with SCITEX color palette and legend
- scitex.plt.gallery.plot_hexbin(plt, rng, ax=None)[source]
Hexagonal binning demo.
Demonstrates: ax.hexbin()
- scitex.plt.gallery.plot_imshow(plt, rng, ax=None)[source]
Image display demo.
Demonstrates: ax.imshow()
Uses the scitex icon if available, otherwise falls back to synthetic data.
- scitex.plt.gallery.plot_matshow(plt, rng, ax=None)[source]
Matrix display demo.
Demonstrates: ax.matshow()
- scitex.plt.gallery.plot_pcolor(plt, rng, ax=None)[source]
Pseudocolor plot demo.
Demonstrates: ax.pcolor()
- scitex.plt.gallery.plot_pcolormesh(plt, rng, ax=None)[source]
Pseudocolor mesh plot demo.
Demonstrates: ax.pcolormesh()
- scitex.plt.gallery.plot_spy(plt, rng, ax=None)[source]
Sparse matrix visualization demo.
Demonstrates: ax.spy()
- scitex.plt.gallery.plot_contour(plt, rng, ax=None)[source]
Contour plot demo.
Demonstrates: ax.contour()
- scitex.plt.gallery.plot_contourf(plt, rng, ax=None)[source]
Filled contour plot demo.
Demonstrates: ax.contourf()
- scitex.plt.gallery.plot_tricontour(plt, rng, ax=None)[source]
Triangular contour demo.
Demonstrates: ax.tricontour()
- scitex.plt.gallery.plot_tricontourf(plt, rng, ax=None)[source]
Filled triangular contour demo.
Demonstrates: ax.tricontourf()
- scitex.plt.gallery.plot_tripcolor(plt, rng, ax=None)[source]
Unstructured triangular grid demo.
Demonstrates: ax.tripcolor()
- scitex.plt.gallery.plot_triplot(plt, rng, ax=None)[source]
Triangular mesh plot demo.
Demonstrates: ax.triplot()
- scitex.plt.gallery.plot_acorr(plt, rng, ax=None)[source]
Autocorrelation demo with legend.
Demonstrates: ax.acorr() with SCITEX color palette and legend
- scitex.plt.gallery.plot_angle_spectrum(plt, rng, ax=None)[source]
Phase angle spectrum demo.
Demonstrates: ax.angle_spectrum()
- scitex.plt.gallery.plot_cohere(plt, rng, ax=None)[source]
Coherence demo.
Demonstrates: ax.cohere()
- scitex.plt.gallery.plot_csd(plt, rng, ax=None)[source]
Cross spectral density demo.
Demonstrates: ax.csd()
- scitex.plt.gallery.plot_magnitude_spectrum(plt, rng, ax=None)[source]
Magnitude spectrum demo.
Demonstrates: ax.magnitude_spectrum()
- scitex.plt.gallery.plot_phase_spectrum(plt, rng, ax=None)[source]
Phase spectrum demo.
Demonstrates: ax.phase_spectrum()
- scitex.plt.gallery.plot_psd(plt, rng, ax=None)[source]
Power spectral density demo.
Demonstrates: ax.psd()
- scitex.plt.gallery.plot_specgram(plt, rng, ax=None)[source]
Spectrogram demo.
Demonstrates: ax.specgram()
- scitex.plt.gallery.plot_xcorr(plt, rng, ax=None)[source]
Cross-correlation demo.
Demonstrates: ax.xcorr()
- scitex.plt.gallery.plot_quiver(plt, rng, ax=None)[source]
Vector field demo.
Demonstrates: ax.quiver()
- scitex.plt.gallery.plot_streamplot(plt, rng, ax=None)[source]
Streamline plot demo.
Demonstrates: ax.streamplot()
- scitex.plt.gallery.plot_eventplot(plt, rng, ax=None)[source]
Event/spike raster demo with multiple channels and legend.
Demonstrates: ax.eventplot() with SCITEX color palette and legend
- scitex.plt.gallery.plot_graph(plt, rng, ax=None)[source]
Graph/network visualization demo.
Demonstrates: ax.graph() with NetworkX
- scitex.plt.gallery.plot_loglog(plt, rng, ax=None)[source]
Log-log plot demo with multiple power laws and legend.
Demonstrates: ax.loglog() with SCITEX color palette and legend
- scitex.plt.gallery.plot_semilogx(plt, rng, ax=None)[source]
Semi-log X plot demo with multiple series and legend.
Demonstrates: ax.semilogx() with SCITEX color palette and legend
Axis Methods
The following methods are available on ax objects returned by stx.plt.subplots().
Line Plots
fig, ax = stx.plt.subplots()
- ax.stx_line(values_1d, xx=None, track=True, id=None, **kwargs)
Plot a simple line from 1D array.
- Parameters:
values_1d – Y values
xx – Optional X values
track – Track data for CSV export
id – Identifier for tracking
- ax.stx_shaded_line(xs, ys_lower, ys_middle, ys_upper, color=None, label=None, track=True, id=None, **kwargs)
Plot a line with shaded area between bounds.
- Parameters:
xs – X values
ys_lower – Lower bound Y values
ys_middle – Middle line Y values
ys_upper – Upper bound Y values
Statistical Plots
- ax.stx_mean_std(values_2d, xx=None, sd=1, track=True, id=None, **kwargs)
Plot mean line with standard deviation shading.
- Parameters:
values_2d – 2D array (samples x timepoints)
xx – Optional X values
sd – Number of standard deviations for shading
- ax.stx_mean_ci(values_2d, xx=None, perc=95, track=True, id=None, **kwargs)
Plot mean line with confidence interval shading.
- Parameters:
values_2d – 2D array (samples x timepoints)
xx – Optional X values
perc – Confidence interval percentage (default: 95)
- ax.stx_median_iqr(values_2d, xx=None, track=True, id=None, **kwargs)
Plot median line with interquartile range shading.
- Parameters:
values_2d – 2D array (samples x timepoints)
xx – Optional X values
- ax.stx_errorbar(x, y, yerr=None, xerr=None, track=True, id=None, **kwargs)
Error bar plot with scitex styling.
- Parameters:
x – X coordinates
y – Y coordinates
yerr – Y error values
xerr – X error values
Distribution Plots
- ax.stx_kde(values_1d, cumulative=False, fill=False, track=True, id=None, **kwargs)
Plot kernel density estimate.
- Parameters:
values_1d – 1D array of values
cumulative – Plot cumulative distribution
fill – Fill under curve
- ax.stx_ecdf(values_1d, track=True, id=None, **kwargs)
Plot empirical cumulative distribution function.
- Parameters:
values_1d – 1D array of values
- ax.hist(x, bins=10, range=None, align_bins=True, track=True, id=None, **kwargs)
Plot histogram with bin alignment support.
- Parameters:
x – Input data
bins – Number of bins or bin edges
align_bins – Align bins with other histograms on same axis
Categorical Plots
- ax.stx_box(values_list, colors=None, track=True, id=None, **kwargs)
Boxplot with scitex styling.
- Parameters:
values_list – List of arrays for each box
colors – Optional colors for boxes
- ax.stx_violin(values_list, x=None, y=None, hue=None, labels=None, colors=None, half=False, track=True, id=None, **kwargs)
Violin plot with scitex styling.
- Parameters:
values_list – List of arrays or DataFrame
half – Show half violins
Scatter Plots
- ax.stx_scatter(x, y, track=True, id=None, **kwargs)
Scatter plot with scitex styling.
- Parameters:
x – X coordinates
y – Y coordinates
- ax.stx_scatter_hist(x, y, hist_bins=20, scatter_alpha=0.6, track=True, id=None, **kwargs)
Scatter plot with marginal histograms.
- Parameters:
x – X coordinates
y – Y coordinates
hist_bins – Number of histogram bins
Bar Plots
- ax.stx_bar(x, height, track=True, id=None, **kwargs)
Vertical bar plot with scitex styling.
- Parameters:
x – X coordinates
height – Bar heights
- ax.stx_barh(y, width, track=True, id=None, **kwargs)
Horizontal bar plot with scitex styling.
- Parameters:
y – Y coordinates
width – Bar widths
Heatmaps
- ax.stx_heatmap(values_2d, x_labels=None, y_labels=None, cmap='viridis', cbar_label='', show_annot=True, track=True, id=None, **kwargs)
Plot annotated heatmap.
- Parameters:
values_2d – 2D array
x_labels – Column labels
y_labels – Row labels
show_annot – Show value annotations
- ax.stx_conf_mat(conf_mat_2d, x_labels=None, y_labels=None, title='Confusion Matrix', track=True, id=None, **kwargs)
Plot confusion matrix.
- Parameters:
conf_mat_2d – 2D confusion matrix array
x_labels – Predicted class labels
y_labels – True class labels
- ax.stx_image(arr_2d, track=True, id=None, **kwargs)
Display 2D array as image.
- Parameters:
arr_2d – 2D array
Special Plots
- ax.stx_raster(spike_times_list, time=None, labels=None, colors=None, track=True, id=None, **kwargs)
Plot spike raster.
- Parameters:
spike_times_list – List of spike time arrays per neuron
time – Optional time array
- ax.stx_fillv(starts_1d, ends_1d, color='red', alpha=0.2, track=True, id=None, **kwargs)
Fill vertical regions.
- Parameters:
starts_1d – Start positions
ends_1d – End positions
- ax.stx_rectangle(xx, yy, width, height, track=True, id=None, **kwargs)
Draw rectangle.
- Parameters:
xx – X position
yy – Y position
width – Rectangle width
height – Rectangle height
- ax.stx_joyplot(arrays, track=True, id=None, **kwargs)
Plot joyplot (ridgeline plot).
- Parameters:
arrays – List of arrays
Seaborn Wrappers
- ax.sns_barplot(data=None, x=None, y=None, track=True, id=None, **kwargs)
- ax.sns_boxplot(data=None, x=None, y=None, strip=False, track=True, id=None, **kwargs)
- ax.sns_violinplot(data=None, x=None, y=None, track=True, id=None, **kwargs)
- ax.sns_stripplot(data=None, x=None, y=None, track=True, id=None, **kwargs)
- ax.sns_swarmplot(data=None, x=None, y=None, track=True, id=None, **kwargs)
- ax.sns_heatmap(*args, xyz=False, track=True, id=None, **kwargs)
- ax.sns_histplot(data=None, x=None, y=None, bins=10, track=True, id=None, **kwargs)
- ax.sns_kdeplot(data=None, x=None, y=None, track=True, id=None, **kwargs)
- ax.sns_scatterplot(data=None, x=None, y=None, track=True, id=None, **kwargs)
- ax.sns_lineplot(data=None, x=None, y=None, track=True, id=None, **kwargs)
- ax.sns_jointplot(*args, track=True, id=None, **kwargs)
- ax.sns_pairplot(*args, track=True, id=None, **kwargs)
Axis Utilities
- ax.set_xyt(x=None, y=None, t=None)
Set xlabel, ylabel, and title in one call.
- ax.hide_spines(*spines)
Hide specified spines (top, right, bottom, left).