Skip to content

Inequalities and shaded regions

An inequality shades the half-plane or region that satisfies it. fillOpacity controls how strongly, so overlapping regions stay readable.

examples/12-inequalities.axis

config {
showGrid: true
}
"Inequalities"
folder "Half planes" {
y > 2x - 3 @ color: RED, fillOpacity: 0.2
y < -x + 4 @ color: BLUE, fillOpacity: 0.2
"Where both hold, the shading doubles up."
}
folder "Regions from curves" {
y > x ^ 2 - 4 @ color: GREEN, fillOpacity: 0.25
x ^ 2 + y ^ 2 <= 16 @ color: PURPLE, fillOpacity: 0.2
"lines: false drops the boundary curve."
abs(x) + abs(y) <= 3 @ color: ORANGE, fillOpacity: 0.4, lines: false
}
folder "A bounded strip" {
"Two inequalities in one statement bound a band, with y on its own in the middle - Desmos only shades a band that is solved for a variable."
sin(x) - 1 < y < sin(x) + 1 @ color: RED, fillOpacity: 0.25
y = sin(x) @ color: RED, lineWidth: 3
}
folder "Restricting a shaded region" {
"A brace group trims the region to a window."
y < 4 - x ^ 2 {y > 0} @ color: BLUE, fillOpacity: 0.3
}
Open in playground →