OrdinalScale
OrdinalScale[{cat1,cat2,…,catn}]
represents a set of ordered categories cati with order cat1<cat2<…<catn.
OrdinalScale[{cat1,…,catn},{val1,…,valn}]
associates the category cati with the numeric value vali.
OrdinalScale[cat1val1,…,catnvaln >]
also associates the category cati with the numeric value vali.
OrdinalScale[{cat1,…,catn},vals,{lab1,…,labn}]
displays the category cati as the corresponding labi when used as a label in plots etc.
OrdinalScale[…,catilabi,… >]
uses labi to represent cati in plots.
Details and Options
- Ordinal scales are used to rank ordered things such as movie ratings, product quality and pain level. Typical examples include:
-
tiny<small<medium<large size categories ★<★★<★★★<★★★★<★★★★★ rating categories F<D<C<B<A grade categories - Use OrdinalScale with ScalingFunctions to place categorical values along an axis.
- The categories cati can be any expression.
- By default, the category cati is given the value i for vali.
- The numerical values vali can be any real number.
- cati is considered to be less than catj if vali<valj.
- If two categories cati and catj have the same associated numeric value val, they are considered to be in the same categorical class and one will be selected as the typical element.
- When specifying labels, the value specification vals may be Automatic.
- OrdinalScale[…][prop] gives the specified property of an ordinal scale.
- Possible properties include:
-
"CategoryAssociation" association of the form <…,valicati,… > "CategoryList" list of categories {cat1,…,catn} "LabelAssociation" association of the form <…,catilabi,… > "LabelList" list of labels {lab1,…,labn} "ValueAssociation" association of the form <…,cativali,… > "ValueList" list of values {val1,…,valn} "Properties" list of supported properties - OrdinalScale[…][prop,arg] or OrdinalScale[…][prop][arg] return the property prop according to the argument arg.
- Possible properties prop and arguments arg include:
-
"Category" vali categories cati corresponding to vali "Categories" {…,vali,…} list of categories cati corresponding to vali "Label" cati labels labi corresponding to cati "Labels" {…,cati,…} list of labels labi corresponding to cati "Value" cati values vali corresponding to cati "Values" {…,cati,…} list of values vali corresponding to cati
Examples
open allclose allBasic Examples (5)
Scope (31)
Example Scales (10)
Categories, Values and Labels (7)
Categories can be any type of expression, such as strings:
Numeric categories do not use a numeric scale:
By default, OrdinalScale values are automatically assigned:
Provide the values for the 5th octave of music notes:
Categories that are omitted from the scale are treated as missing and are not shown:
By default, the categories are used as labels:
Specify labels to use in place of the categories:
Extracting Properties (14)
Obtain a list of properties for a nominal scale:
Extract the list of categories:
Extract the mapping between categories and values:
Extract the mapping between values and categories:
Extract the mapping between categories and labels:
Determine the value for a single category:
Determine the category for a value:
Determine the values for a list of categories:
Determine the labels for a list of categories:
Use in a visualization function:
By default, values are automatically assigned:
Orders are specified automatically:
Use Association to specify categories and values:
Applications (8)
Agriculture (2)
Finance (2)
Markov Chain (1)
Visualize simulations of the gambler's ruin process in ListLinePlot with OrdinalScale:
With a winning probability of 0.5, the player's initial wealth is 7 and the total wealth is 10 between the player and the host. The states here are the integers 1 through 11, representing the gambler's wealth plus one:
Simulate 15 times to observe that given a fair game, the winning possibility—that is the possibility of taking the whole wealth—depends on the player's initial wealth and the total wealth:
Classification (1)
Use OrdinalScale value associations for classification:
Text
Wolfram Research (2022), OrdinalScale, Wolfram Language function, https://reference.wolfram.com/language/ref/OrdinalScale.html.
CMS
Wolfram Language. 2022. "OrdinalScale." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/OrdinalScale.html.
APA
Wolfram Language. (2022). OrdinalScale. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/OrdinalScale.html