On this page

GuideAxis

Axis guide for positional aesthetics x and y: title, tick marks, labels, and collision. Not valid on color, fill, or other style channels.

Channels

Bind this guide with the shell channel prop (or the matching key under guides in JSON). Only these aesthetics validate:

  • x
  • y

Only x and y. Style aesthetics never accept an axis guide — use legend, colorbar, colorsteps, or none instead.

Svelte component

import { GGPlot, GeomPoint, GuideAxis } from "@ggsvelte/svelte";

<GGPlot data={rows} aes={{ x: "displ", y: "hwy", color: "class" }}>
  <GeomPoint />
  <GuideAxis channel="x" title="Label" showTicks={false} />
</GGPlot>

JSON and helpers

import { guideAxis, guides } from "@ggsvelte/spec";

guides({ x: guideAxis({ title: "Label", showTicks: false }) })
// → { guides: { x: { type: "axis", … } } }
{
  "guides": {
    "x": {
      "type": "axis"
    }
  }
}

Helper: guideAxis (alias guide_axis). Schema type: AxisGuideSpec. Portable type: "axis".

Props

Every shell takes a required channel prop (not part of the portable guide object — it is the key under guides). Options below map 1:1 to the guide JSON fields.

channel required

"x" | "y"

Aesthetic this guide configures. Must be one of the channels listed above.

title

string

Optional guide title string (max 256 characters). Omit to use the scale or labs title.

showTicks

boolean

When false, hide tick marks on the axis or colorbar.

showLabels

boolean

When false, hide tick or step labels on the axis, colorbar, or colorsteps guide.

collision

"auto" | "preserve" | "ellipsis"

How long labels behave when they do not fit: ellipsis, wrap (legend only), preserve (axis), auto (axis), or error.

theme

GuideThemeSpec

Bounded presentation overrides for this guide block (title/label size, gaps, colorbar size).

← All guides · Positions · Scales and guides