-
Notifications
You must be signed in to change notification settings - Fork 167
Scales
Scales are a crucial building block in visualization design: they transform a domain of data values into a range of visual values (pixels, colors, sizes, shapes, etc.). When a data field is dropped over a mark property, Lyra tries to automatically infer a scale:
Scales can also be created manually by clicking the |
A scale's type is dependent on the type of its domain. Ordinal scales have a discrete domain (such as names or categories), time scales have time domains, and the remaining types (called quantitative scales for example linear, log, etc.) have continuous domains (e.g. numbers).
A number of different options are available based on the scale type.
-
Uniform: When checked, the scale distributes the range values at uniformly spaced points. This is most useful for point-based marks (symbol, line, area, text). The spacing of the points can be adjusted using the padding property. When unchecked, the scale instead constructs evenly-spaced bands, rather than points. This is most useful for setting the width or height of rect marks.
-
Padding: Applies spacing among the uniform points/bands of the scale's range.
Quantitative scales include linear
, log
, pow
, sqrt
, quantile
, and quantize
and have these additional properties:
-
Clamp: if checked, data values that lie outside the specified domain are clamped to either the minimum or maximum range value.
-
Nice: if checked, Lyra rounds values in the domain to use more human-friendly number range (e.g. 7 instead of 6.96).
-
Zero: if checked, ensures that a zero baseline value is included in the scale domain.
Time scales include time
and utc
and have these additional properties:
-
Clamp: if checked, data values that lie outside the specified domain are clamped to either the minimum or maximum range value.
-
Nice: If a value is chosen from the dropdown, Lyra rounds values in the data domain to the particular time interval for a more human-friendly range value.
A scale's domain may either be drawn automatically from a data field (simply drag a field from the table, and drop it over the Field
property), or may be specified manually. Set the From
property to values
and then enter domain values into the texboxes. For ordinal scales, enumerate all the necessary values of the domain. For quantitative scales, it's sufficient to just enter the minimum and maximum values. Lyra will automatically evaluate continuous values between these two.
A scale's range can be either set manually (set From
to values
) or set to a built-in preset range. These built-in ranges are available for spatial
, colors
, shapes
ranges. Simply select the appropriate range type, and drag the built-in range type.