MarkColor
Auto-generated from the config schema in the source — see the config guide for concepts. Provided by the marks plugin. View source.
Example usage
{ mark: 'bar', encoding: { y: 'score', color: { value: 'steelblue' } } }{ mark: 'point', encoding: { y: 'score', color: 'type' } }{
mark: 'point',
encoding: { y: 'score', color: { field: 'strand', domain: ['1', '-1'] } },
}{
mark: 'span',
encoding: {
color: {
field: 'score',
scale: 'log',
domainMin: 1,
domainMax: 1000,
range: ['white', 'red'],
},
},
}{
mark: 'bar',
encoding: {
y: 'score',
color: {
field: 'score',
scale: 'linear',
domainMin: -2,
domainMax: 6,
domainMid: 0,
range: ['blue', 'white', 'red'],
},
},
}{
mark: 'point',
encoding: {
y: 'score',
color: {
field: 'pip',
scale: 'threshold',
domain: [0.1, 0.5],
range: ['#357ebd', '#eea236', '#d43f3a'],
},
},
}A mark's encoding.color: one CSS color or jexl: callback for every
instance, or a field through a categorical scale (a range color per
value), a linear or log scale (a ramp between domainMin and
domainMax, domainMid placing its middle stop where a diverging ramp
turns) or a threshold scale (a range color per interval between the
cut points domain lists). A string is the field, as every channel's is
inside encoding; a constant is { value }. A scale is what the legend
describes.
Config slots
Slot types (fileLocation, frozen, ...) are explained in the config slot types reference. Slots a base configuration contributes are listed here too, so this table is the whole surface.
| Slot | Description |
|---|---|
valuemaybeColor | A CSS color, or a jexl callback over feature returning one, for a mark whose color is not a scale. Unset, a mark paints in the default blue, #0068d1, and a text mark prints in the page's text color.callback args: feature |
breaksstringArray = [] | The values a categorical key lists, in this order; empty lists every value the loaded regions met. A value left out still paints, as ggplot2's breaks leaves it. |
missingLabelmaybeString | The key's name for a feature with nothing in field; unset is "(no value)". |
fieldfeatureField = '' | the feature field a scale reads, or a jexl expression over feature, which is slower per feature and so the opt-in |
scalemaybeStringEnum (none, categorical, linear, log, threshold) | categorical hands out range colors per distinct value; linear and log read the value between domainMin and domainMax into a ramp; threshold cuts the value at the domain and hands each interval a range color; none paints value, keeping a field for a switch back; unset is linear for score and categorical for any other field |
domainstringArray = [] | for a categorical scale, the values in legend order, walking the range from the first entry and continuing into the default palette past its end (a value left out derives its color from itself and never takes a listed value's, so every region agrees); for a threshold scale, the cut points in ascending order, a value taking the range entry for the number of them it is at or past, so range has one entry more than this; a linear or log scale reads domainMin and domainMax instead |
domainMinmaybeNumber | the bottom of a linear or log scale's domain; unset follows the loaded values |
domainMaxmaybeNumber | the top of a linear or log scale's domain; unset follows the loaded values |
domainQuantilenumber = 1 | the quantile an open end of a linear or log scale follows over the loaded values: 1 their extremes, 0.99 clips the outermost 1% at each end, each sign measured on its own advanced |
rangecolorArray = [] | CSS colors a categorical scale hands its domain in order, a threshold scale its intervals, or a linear or log scale's ramp as evenly spaced stops; empty is the default palette, or the scheme |
labelsstringArray = [] | key label for each domain value, one each in order, or under threshold for each interval from the lowest; one past the list keeps its own name |
schememaybeStringEnum (viridis, magma, inferno, cividis, juicebox, fall, reds, blues, redblue, purpleorange, redgreyblue, blueyellowred) | a named ramp: a linear or log scale runs along it, and a threshold that writes cuts takes one color per interval from end to end; range's colors, where it lists any, win over it |
reverseboolean = false | turns the ramp round, so its last color paints the bottom of a linear or log domain or a threshold's lowest interval |
domainMidmaybeNumber | the value the ramp's middle stop sits at, so a diverging ramp centres somewhere other than the middle of the domain, both sides on one scale: the farther end of the domain reaches its end color and equal distances from the middle take equal colors; unset, the stops are evenly spaced across it |
titlemaybeString | key title; unset keeps the display's own heading, "" draws none |
descendingmaybeBoolean | threshold key lists the highest interval first; unset follows the field's preset, else the lowest first |
Related links
- Config guide: GWAS track