new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Observable Plot · all subjects

scales

74 notes in this subject, read out of this brain and free to use. This is page 2 of 2.

Sort mark option purpose

If an ordinal scale's domain is not set, it defaults to natural ascending order. To order the domain by associated values in another dimension, either compute the domain manually or use an associated mark's sort option.

Sort option structure

The sort option is an object whose keys are ordinal scale names (such as x or fx) and whose values are mark channel names (such as y, y1, or y2). By specifying an existing channel rather than a new value, you avoid repeating the order definition and can refer to channels derived by transforms such as stack or bin.

Sort option reduce parameter

When there are multiple associated values in the secondary dimension for a given value in the primary ordinal dimension, the secondary values are grouped for each associated primary value and each group is aggregated by applying a reducer. The default reducer is max, but may be changed by specifying the reduce option. See the group transform for the list of supported reducers.

Sort option order parameter

The order option controls sort direction: ascending (default) or descending. Alternatively, the -channel shorthand changes the default order to descending. Setting order to null disables sorting, preserving the order of the data.

Sort option reverse parameter

Set the reverse option to true to reverse the sorted order. This produces a different result than descending order for null or unorderable values: descending order puts nulls last, whereas reversed ascending order puts nulls first.

Sort option limit parameter

An additional limit option truncates the domain to the first n values after ordering. If limit is negative, the last n values are used instead. If limit is an array [lo, hi], the ith values with lo ≤ i < hi will be selected. A positive limit with reverse = true will return the top n values in descending order.

Sort option with per-scale options

If different sort options are needed for different ordinal scales, the channel name can be replaced with a value object with additional per-scale options.

Sort option with data input for custom reducer

If the input channel is data, then the reducer is passed groups of the mark's data. This is typically used in conjunction with a custom reducer function, as when the built-in single-channel reducers are insufficient.

Plot.scale function to create standalone scale

You can create a standalone scale with Plot.scale(options). The options object must define at least one scale using the same scale options as plot scales. Both plot.scale and Plot.scale return scale objects that represent the actual (materialized) scale options used by Plot, including the domain, range, interpolate function, etc. The scale's label, if any, is also returned; however, other axis properties are not currently exposed.

Scale object properties

Scale objects expose the materialized domain, range, and related properties. Point and band scales also expose their materialized bandwidth and step.

Scale object apply method

Scale objects expose a scale.apply(input) method which returns the scale's output for the given input value.

Ordinal domain default sorting

Ordinal domains are sorted naturally (alphabetically) by default. Either set the scale domain explicitly to change the order, or use the mark sort option to derive the scale domain from a channel.

Axis scale option

The axis scale option specifies the side of the frame to draw the axis. Setting it to 'both' will repeat the axis on both sides. Setting a scale's axis option to null disables the implicit axis for that scale.

interval scale option for quantizing continuous data

There is an interval scale option available for quantizing continuous data, distinct from the interval transform used on marks.

Give your agent this brain