Skip to content

Styling

Every visual property is metadata after an @, or on a line of its own inside an @{ } block. Anything left out falls back to the Desmos default, so a statement only names what it changes.

examples/04-styling.axis

config {
lockViewport: false
}
"Styling"
folder "Line style" {
y = x + 6 @ color: RED, lineStyle: SOLID, lineWidth: 5
y = x + 4 @ color: BLUE, lineStyle: DASHED, lineWidth: 3
y = x + 2 @ color: GREEN, lineStyle: DOTTED, lineWidth: 3
y = x @ color: PURPLE, lineWidth: 8, lineOpacity: 0.35
}
folder "Point style" {
"pointStyle: POINT, OPEN, CROSS"
(-4, 4) @ color: RED, pointStyle: POINT, pointSize: 20
(-2, 4) @ color: BLUE, pointStyle: OPEN, pointSize: 20
(0, 4) @ color: GREEN, pointStyle: CROSS, pointSize: 20
"pointOpacity fades a point without hiding it"
(2, 4) @ color: PURPLE, pointSize: 30, pointOpacity: 0.3
(4, 4) @ color: ORANGE, pointSize: 30, pointOpacity: 1
}
folder "Fills" {
"fill shades the inside of a closed parametric curve or a polygon"
(3cos(t), 3sin(t)) @ color: BLUE, fill, fillOpacity: 0.25, domain: 0..tau
"lines: false keeps the fill and drops the outline"
(6 + 2cos(t), 2sin(t)) @ color: RED, fill, fillOpacity: 0.5, lines: false, domain: 0..tau
"An inequality shades itself; fillOpacity says how strongly"
(x + 6) ^ 2 + y ^ 2 <= 4 @ color: GREEN, fillOpacity: 0.3
}
folder "Labels" {
(0, 0) @ color: BLACK, label: "Origin", showLabel
(3, 3) @ color: RED, label: "Above", showLabel, labelOrientation: above
(-3, 3) @ color: BLUE, label: "Below", showLabel, labelOrientation: below
(3, -3) @ color: GREEN, label: "Bigger", showLabel, labelSize: 2
(6, 0) @ color: ORANGE, label: "Turned", showLabel, labelAngle: pi / 4
"interactiveLabel shows the label only on hover or click; editableLabelMode lets the viewer type into it."
(-6, 0) @ color: ORANGE, label: "Click me", showLabel, interactiveLabel
(0, -6) @ color: ORANGE, label: "Edit me", showLabel, editableLabelMode: TEXT
"description is read by screen readers."
(-3, -3) @{
color: PURPLE
showLabel
label: "Described"
description: "Lower left corner point"
}
}
folder "Points or lines only" {
"A list of points draws its points and nothing between them"
A = [(-5, -6), (-3, -5), (-1, -6), (1, -5)] @ color: ORANGE
"lines joins them up, in order"
B = [(-5, -8), (-3, -7), (-1, -8), (1, -7)] @ color: BLUE, lines
"and with points: false only the path is left"
C = [(-5, -10), (-3, -9), (-1, -10), (1, -9)] @ color: GREEN, lines, points: false
}
Open in playground →