ggvis supports the following types of scales. Typical uses for each scale
type are listed below:
numeric For continuous numeric values.
nominal For character vectors and factors.
ordinal For ordered factors (these presently behave the same as
nominal).
logical For logical (TRUE/FALSE) values.
datetime For dates and date-times.
Each type has a corresponding function: scale_numeric
,
scale_nominal
, and so on.
The scale types for ggvis are mapped to scale types for Vega, which include
"ordinal", "quantitative", and "time". See ggvis_scale
for more
details.
Given a scale and type, the range is selected based on the combination of the
scale
and type
. For example, you get a different range of
colours depending on whether the data is numeric, ordinal, or nominal. Some
scales also set other properties. For example, nominal/ordinal position
scales also add some padding so that points are spaced away from plot edges.
Not all combinations have an existing default scale. If you use a
combination that does not have an existing combination, it may suggest
you're displaying the data in a suboptimal way. For example, there is
no default for a numeric shape scale, because there's no obvious way to
map continuous values to discrete shapes.