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

  • Ordinal scales are used to rank ordered things such as movie ratings, product quality and pain level. Typical examples include:
  • tiny<small<medium<largesize categories
    <<<<rating categories
    F<D<C<B<Agrade 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"valicategories cati corresponding to vali
    "Categories"{,vali,}list of categories cati corresponding to vali
    "Label"catilabels labi corresponding to cati
    "Labels"{,cati,}list of labels labi corresponding to cati
    "Value"cativalues vali corresponding to cati
    "Values"{,cati,}list of values vali corresponding to cati

Examples

open allclose all

Basic Examples  (5)

Visualize a consumer satisfaction survey data:

Provide values for satisfaction levels:

Specify a label for a category:

Provide the scale order of ordinal data:

Use categorical labels to represent a list of numerical ratings:

Plot a time series of physical exertion with the Borg CR10 scale:

Scope  (31)

Example Scales  (10)

Seven-point Likert rating scale:

Borg-RPE scale for assessing physical exertion:

Borg-CR10 scale:

Moody ratings for bonds:

Sizes:

Judo ranks:

Sizes of container ships:

Pain scale:

USDA beef grades:

USDA orange grades:

USDA egg size grades:

Categories, Values and Labels  (7)

Categories can be any type of expression, such as strings:

Entities:

Colors:

Pictures:

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:

Specify labels for each note:

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:

Provide labels for individual categories:

Labels can be any type of expression:

Extracting Properties  (14)

Obtain a list of properties for a nominal scale:

Extract the list of categories:

Extract the list of values:

Extract the mapping between categories and values:

Extract the mapping between values and categories:

Extract the list of labels:

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:

Specify values:

Specify specific labels:

Orders are specified automatically:

Specify orders manually:

Use Association to specify categories and values:

Categories that share the same value are combined:

Applications  (8)

Agriculture  (2)

Plot a time series of egg size change of a growing hen:

Show the prices of apples based on the types and sizes:

Finance  (2)

Plot US states' bond ratings in 2021 with a predefined Moody rating scale:

Plot in S&P and Fitch rating scales:

Historical S&P bond ranking of Illinois:

Markov Chain  (1)

Visualize simulations of the gambler's ruin process in ListLinePlot with NominalScale:

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 possibilitythat is the possibility of taking the whole wealthdepends on the player's initial wealth and the total wealth:

Education  (1)

Show grades for students in a classroom:

Medical  (1)

Classification  (1)

Use OrdinalScale value associations for classification:

Given a hardness value, find a similar hardwood:

Wolfram Research (2022), OrdinalScale, Wolfram Language function, https://reference.wolfram.com/language/ref/OrdinalScale.html.

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

BibTeX

@misc{reference.wolfram_2022_ordinalscale, author="Wolfram Research", title="{OrdinalScale}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/OrdinalScale.html}", note=[Accessed: 12-August-2022 ]}

BibLaTeX

@online{reference.wolfram_2022_ordinalscale, organization={Wolfram Research}, title={OrdinalScale}, year={2022}, url={https://reference.wolfram.com/language/ref/OrdinalScale.html}, note=[Accessed: 12-August-2022 ]}