Home

Plots

Usage

Start with these tokens when customizing plots:

  • --plot-color-1 through --plot-color-12 for categorical palettes

  • --plot-ramp-start and --plot-ramp-end for sequential scales

  • --plot-background, --plot-panel, and --plot-text-color for contrast

  • --plot-font-family and --plot-font-size for typography

  • --plot-axis-line-color and --plot-grid-color for axis/grid styling

  • --plot-height-min and --plot-aspect-ratio for sizing

Plot theming is applied by the Stencila runtime when rendering plots. For consistent behavior, set plot tokens on :root in your theme CSS. Inline overrides inside a StyledBlock may not affect JS-based plot renderers that read from the document root.

Use --plot-theme: none when you want plotting libraries to use their own defaults. The custom theme applies the tokens above and dark variants automatically when the color scheme changes.

See target-specific mappings in Web/JS, R, and Python.

Tokens

Theme Selection

TokenDescriptionDefault Value
--plot-themeTheme mode (custom, none, or a named theme preset if supported)custom

Available plot presets:

  • bold (themes/plots/bold.css)

  • light (themes/plots/light.css)

Set --plot-theme to one of these preset names to merge the preset into your theme before custom overrides are applied.

Dimensions

TokenDescriptionDefault Value
--plot-aspect-ratioWidth/height ratio1.5
--plot-widthAbsolute width for PNG rendering8in
--plot-heightHeight derived from width and aspect ratiocalc(var(--plot-width) / var(--plot-aspect-ratio))
--plot-dpiDots per inch for PNG rendering100
--plot-height-minMinimum height for web display300px
--plot-height-maxMaximum height for web display800px

Color Palette (Categorical)

TokenDefault ValueDark Default
--plot-color-1var(--color-accent)var(--color-accent-dark)
--plot-color-2hsl(160 70% 45%)hsl(160 60% 55%)
--plot-color-3hsl(35 95% 55%)hsl(35 85% 60%)
--plot-color-4hsl(280 70% 60%)hsl(280 65% 65%)
--plot-color-5hsl(0 70% 55%)hsl(0 65% 60%)
--plot-color-6hsl(190 65% 45%)hsl(190 60% 55%)
--plot-color-7hsl(330 70% 60%)hsl(330 65% 65%)
--plot-color-8hsl(120 55% 40%)hsl(120 50% 50%)
--plot-color-9hsl(45 85% 50%)hsl(45 80% 60%)
--plot-color-10hsl(250 55% 55%)hsl(250 50% 65%)
--plot-color-11hsl(15 75% 55%)hsl(15 70% 60%)
--plot-color-12hsl(200 50% 45%)hsl(200 45% 55%)

Color Ramp

TokenDescriptionDefault Value
--plot-ramp-startSequential ramp start colorcolor-mix(in oklch, var(--color-accent) 5%, var(--plot-background))
--plot-ramp-start-darkRamp start in dark modecolor-mix(in oklch, var(--color-accent-dark) 5%, var(--plot-background-dark))
--plot-ramp-endSequential ramp end colorcolor-mix(in oklch, var(--color-accent) 95%, var(--plot-background))
--plot-ramp-end-darkRamp end in dark modecolor-mix(in oklch, var(--color-accent-dark) 95%, var(--plot-background-dark))

Shape Palette

TokenDefault Value
--plot-shape-1circle
--plot-shape-2square
--plot-shape-3triangle
--plot-shape-4diamond
--plot-shape-5cross
--plot-shape-6star
--plot-shape-7pentagon
--plot-shape-8hexagon

Line Types

TokenDefault Value
--plot-line-type-1solid
--plot-line-type-2dashed
--plot-line-type-3dotted
--plot-line-type-4dashdot
--plot-line-type-5longdash
--plot-line-type-6twodash

Backgrounds and Typography

TokenDescriptionDefault Value
--plot-backgroundOuter plot backgroundvar(--surface-background)
--plot-background-darkOuter background in dark modevar(--surface-background-dark)
--plot-panelInner plot panel backgroundvar(--plot-background)
--plot-panel-darkPanel background in dark modevar(--plot-background-dark)
--plot-text-colorPrimary plot text colorvar(--text-color-primary)
--plot-text-color-darkText color in dark modevar(--text-color-primary-dark)
--plot-font-familyFont stack for plot textvar(--font-family-sans)
--plot-font-sizeBase font size for plot textcalc(var(--text-font-size) * 0.85)
--plot-title-sizePlot title sizecalc(var(--text-font-size) * 1.0)
--plot-subtitle-sizePlot subtitle sizecalc(var(--text-font-size) * 0.92)

Panel Border

TokenDescriptionDefault Value
--plot-panel-borderShow panel border (true/false)true

Padding

TokenDescriptionDefault Value
--plot-paddingBase padding around plotvar(--space-4)
--plot-padding-topTop padding overridevar(--plot-padding)
--plot-padding-bottomBottom padding overridevar(--plot-padding)
--plot-padding-leftLeft padding overridevar(--plot-padding)
--plot-padding-rightRight padding overridevar(--plot-padding)

Axes and Grid

TokenDescriptionDefault Value
--plot-axis-line-colorAxis line colorvar(--plot-text-color)
--plot-axis-line-color-darkAxis line color in dark modevar(--plot-text-color-dark)
--plot-axis-line-widthAxis line widthvar(--border-width-default)
--plot-axis-title-sizeAxis title sizecalc(var(--text-font-size) * 0.85)
--plot-axis-title-weightAxis title font weightvar(--font-weight-normal)
--plot-axis-title-colorAxis title colorvar(--plot-text-color)
--plot-axis-title-color-darkAxis title color in dark modevar(--plot-text-color-dark)
--plot-grid-colorGridline colorcolor-mix(in srgb, var(--text-color-primary) 15%, var(--plot-panel))
--plot-grid-color-darkGridline color in dark modecolor-mix(in srgb, var(--text-color-primary-dark) 15%, var(--plot-panel-dark))
--plot-grid-widthGridline widthvar(--border-width-default)
--plot-grid-x-widthVertical gridline widthvar(--plot-grid-width)
--plot-grid-y-widthHorizontal gridline widthvar(--plot-grid-width)

Legends

TokenDescriptionDefault Value
--plot-legend-backgroundLegend background colorvar(--plot-panel)
--plot-legend-background-darkLegend background in dark modevar(--plot-panel-dark)
--plot-legend-text-colorLegend text colorvar(--plot-text-color)
--plot-legend-text-color-darkLegend text color in dark modevar(--plot-text-color-dark)
--plot-legend-text-sizeLegend text sizecalc(var(--text-font-size) * 0.85)
--plot-legend-border-colorLegend border colorcolor-mix(in srgb, var(--text-color-primary) 20%, var(--surface-elevated))
--plot-legend-border-color-darkLegend border color in dark modecolor-mix(in srgb, var(--text-color-primary-dark) 20%, var(--surface-elevated-dark))
--plot-legend-border-widthLegend border widthvar(--border-width-default)
--plot-legend-positionLegend positionauto

Tooltips

TokenDescriptionDefault Value
--plot-tooltip-backgroundTooltip backgroundcolor-mix(in srgb, var(--surface-background) 95%, black)
--plot-tooltip-background-darkTooltip background in dark modecolor-mix(in srgb, var(--surface-background-dark) 85%, black)
--plot-tooltip-text-colorTooltip text colorvar(--text-color-primary)
--plot-tooltip-text-color-darkTooltip text color in dark modevar(--text-color-primary-dark)

Marks

TokenDescriptionDefault Value
--plot-point-opacityPoint fill opacity0
--plot-point-sizePoint sizecalc(var(--space-2) * 0.75)
--plot-line-widthLine widthvar(--border-width-thick)
--plot-area-opacityArea fill opacity0.25

Examples

Default Plots

Standard plot styling with no design token overrides:

:root {
  /* No design token overrides */
}

Echarts

Line Plot

Echarts

Plotly

Vega-Lite

Scatter Plot

Echarts

Plotly

Vega-Lite

Bar Chart

Echarts

Plotly

Vega-Lite

Heatmap

Echart

Plotly

Vega-Lite

Pie Chart

Echarts

Plotly

Vega-Lite

© 2026 Stencila