Skip to content

API Reference: Themes

Hannes Suhr edited this page Mar 9, 2026 · 4 revisions

API Reference: Themes

FastPlot includes a configurable theme system with 5 built-in presets and full customization.

FastPlotTheme

Usage

t = FastPlotTheme('dark');
t = FastPlotTheme('default', 'FontSize', 14, 'LineWidth', 2.0);
t = FastPlotTheme(struct('Background', [0 0 0]));

Apply to FastPlot:

fp = FastPlot('Theme', 'dark');
fp = FastPlot('Theme', t);

Built-in Presets

Preset Description
'default' White background, standard MATLAB colors
'dark' Dark gray background, bright lines
'light' Soft white background, muted lines
'industrial' High contrast, engineering style
'scientific' Publication-ready, serif font, no grid, colorblind-safe palette

Theme Fields

Field Type Description
Background RGB triplet Figure background color
AxesColor RGB triplet Axes background color
ForegroundColor RGB triplet Text, tick labels, axis lines
GridColor RGB triplet Grid line color
GridAlpha number Grid transparency
GridStyle string Grid line style ('-', '--', ':', '-.')
FontName string Font family
FontSize number Base font size
TitleFontSize number Title font size
LineWidth number Default line width
LineColorOrder Nx3 matrix or string Color palette ('vibrant', 'muted', 'colorblind')
ThresholdColor RGB triplet Default threshold line color
ThresholdStyle string Default threshold line style
ViolationMarker string Default violation marker shape
ViolationSize number Default violation marker size
BandAlpha number Default band fill transparency

Theme Inheritance

Themes cascade with this priority (highest to lowest):

  1. Element-level override (e.g., Color on addLine)
  2. Tile theme (setTileTheme)
  3. Figure theme (FastPlotFigure constructor)
  4. 'default' preset (fallback)

Custom Theme Example

myTheme = FastPlotTheme('dark', ...
    'FontSize', 14, ...
    'LineWidth', 2.0, ...
    'LineColorOrder', 'colorblind', ...
    'GridAlpha', 0.3);

fig = FastPlotFigure(2, 2, 'Theme', myTheme);

Per-Tile Theme Override

fig = FastPlotFigure(2, 2, 'Theme', 'dark');
fig.setTileTheme(3, struct('Background', [0.1 0.1 0.2]));

Clone this wiki locally