WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center

NominalScale [{cat1,cat2,,catn}]

represents a set of unordered categories cati.

NominalScale [<|cat1lab1,,catnlabn|>]

also associates the category cati with the labels labi.

NominalScale [,<|catilabi,|>]

uses labi to represent cati in plots.

NominalScale [Automatic ]

automatically determines the categories.

Details and Options
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Example Scales  
Categories and Labels  
Extracting Properties  
Options  
RotateLabel  
Applications  
Basic Applications  
Agriculture  
Chemistry  
Show More Show More
Commerce  
Weather  
Education  
Biology  
Social Sciences  
Markov Chain  
See Also
History
Cite this Page

NominalScale [{cat1,cat2,,catn}]

represents a set of unordered categories cati.

NominalScale [<|cat1lab1,,catnlabn|>]

also associates the category cati with the labels labi.

NominalScale [,<|catilabi,|>]

uses labi to represent cati in plots.

NominalScale [Automatic ]

automatically determines the categories.

Details and Options

  • Nominal scales are used to identify things such as products, names and places. Typical examples include:
  • apple,banana,orange, fruit categories
    London,NYC,Miami,Paris, city categories
    sad,happy,angry, emotion categories
  • Use NominalScale with ScalingFunctions to place categorical values along an axis.
  • There is no ordering between the categories; they are either equal or not.
  • The categories cati can be any expression.
  • NominalScale [][prop] gives the specified property of an ordinal scale.
  • Possible properties include:
  • "CategoryList" list of categories {cat1,,catn}
    "LabelAssociation" association of the form <|,catilabi,|>
    "LabelList" list of labels {lab1,,labn}
    "Properties" list of supported properties
  • NominalScale [][prop,arg] or NominalScale[][prop][arg] return the property prop according to the argument arg.
  • Possible properties prop and arguments arg include:
  • "Label" cati label labi corresponding to cati
    "Labels" {,cati,} list of labels labi corresponding to cati

Examples

open all close all

Basic Examples  (4)

Simulate the results of flipping a coin 100 times:

Wolfram Language code: ListPlot[RandomChoice[{"Heads", "Tails"}, 100], ScalingFunctions -> NominalScale[{"Heads", "Tails"}]]

Label "Heads" and "Tails" with "H" and "T", respectively:

Wolfram Language code: ListPlot[RandomChoice[{"Heads", "Tails"}, 100], ScalingFunctions -> NominalScale[<|"Heads" -> "H", "Tails" -> "T"|>]]

Automatically determine the CPU state categories in a time series:

Wolfram Language code: DateListStepPlot[TemporalData[TimeSeries, {{{"Ready", "Block", "Running", "Running", "Block", "New", "New", "Block", "Running", "Suspend", "Termination", "Ready", "Termination", "New", "Suspend", "Ready", "Running", "Termination", "New", "Running", "Suspe ... 3.8592938330383577*^9, 3.8593043264340463*^9, 3.859304976002263*^9, 3.8593105525395226*^9}}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}, ValueDimensions -> 1}}, True, 13.1], ScalingFunctions -> NominalScale[Automatic], Filling -> Bottom]

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

Wolfram Language code: BubbleChart[IconizedObject[«{{Apple type, size, price}, …}»], ScalingFunctions -> {NominalScale[Automatic], NominalScale[{"125s", "113s", "100s", "88s", "80s", "72s", "64s", "56s"}], None}, AspectRatio -> 1 / 2, FrameLabel -> {{"size", None}, {"type", None}}]

Provide labels for coded categories:

Wolfram Language code: BarChart[{2, 3, 2, 1, 5, 3, 3, 1, 1, 3}, ScalingFunctions -> NominalScale[<|1 -> "Full-time", 2 -> "Part-time", 3 -> "Retired", 4 -> "Furloughed", 5 -> "Not Employed"|>], Rule[...]]

Scope  (23)

Example Scales  (11)

Race categories from a survey:

Wolfram Language code: BarChart[{...}, ScalingFunctions -> NominalScale[{"White", "Black", "American Indian", "Asian", "Native Hawaiian", "Other", "Missing"}]]

Marital status:

Wolfram Language code: BarChart[{...}, ScalingFunctions -> NominalScale[{"Never married", "Married", "Widowed", "Divorced"}]]

Gender:

Wolfram Language code: BarChart[{...}, ScalingFunctions -> NominalScale[{"Male", "Female", "Other", "Missing"}]]

Cloud categories:

Wolfram Language code: BarChart[{...}, ScalingFunctions -> NominalScale[{"Cirrus", "Cirrostratus", "Cirrocumulus", "Altocumulus", "Altostratus", "Nimbostratus", "Cumulus", "Stratus", "Cumulonimbus", "Stratocumulus"}]]

Computer type:

Wolfram Language code: BarChart[{...}, ScalingFunctions -> NominalScale[{"Supercomputer", "Server", "Desktop", "Laptop", "Tablet"}]]

Operating system:

Wolfram Language code: BarChart[{...}, ScalingFunctions -> NominalScale[{"Windows", "Linux", "macOS", "Android", "iOS"}]]

Continents:

Wolfram Language code: BarChart[{...}, ScalingFunctions -> NominalScale[{"Africa", "Antarctica", "Asia", "Australia", "Europe", "North America", "South America"}]]

Currencies:

Wolfram Language code: BarChart[{...}, ScalingFunctions -> NominalScale[{"Dollars", "Euros", "Yuan", "Yen", "Pesos", "Pounds"}]]

Languages:

Wolfram Language code: BarChart[{...}, ScalingFunctions -> NominalScale[{"Chinese", "English", "French", "German", "Spanish", "Japanese"}]]

Car types:

Wolfram Language code: BarChart[{...}, ScalingFunctions -> NominalScale[{"Sedan", "Coupe", "SUV", "Truck", "Minivan", "Van"}]]

Sports:

Wolfram Language code: BarChart[{...}, ScalingFunctions -> NominalScale[{"Basketball", "Baseball", "Soccer", "Football", "Hockey", "Cricket", "Volleyball"}]]

Categories and Labels  (7)

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

Wolfram Language code: BarChart[{...}, ScalingFunctions -> NominalScale[{"Apple", "Banana", "Orange", "Pineapple"}]]

Entities:

Wolfram Language code: BarChart[{...}, ScalingFunctions -> NominalScale[{Entity["Country", "France"], Entity["Country", "Germany"], Entity["Country", "Spain"], Entity["Country", "Japan"]}]]

Colors:

Wolfram Language code: BarChart[{...}, ScalingFunctions -> NominalScale[{Red, Orange, Yellow, Green, Blue, Purple}]]

Pictures:

Wolfram Language code: BarChart[{...}, ScalingFunctions -> NominalScale[{[image], [image], [image], [image], [image]}]]

Numeric categories do not use a numeric scale:

Wolfram Language code: BarChart[{2, 1, 4, 3, 5, 3, 99, 4, 2, 1, 3, 5, 99, 4, 5, 1}, ScalingFunctions -> NominalScale[Automatic]]

Assign labels and an order to numeric values:

Wolfram Language code: BarChart[{2, 1, 4, 3, 5, 3, 99, 4, 2, 1, 3, 5, 99, 4, 5, 1}, ScalingFunctions -> NominalScale[<|99 -> "n/a", 1 -> "happy", 2 -> "sad", 3 -> "angry", 4 -> "bored", 5 -> "amused"|>]]

Automatically detected categories are shown in the order they appear in the data:

Wolfram Language code: BarChart[{"Rudy", "Katrina", "Bob", "Katrina", "Rudy", "Michelle", "Roger", "Bob"}, ScalingFunctions -> NominalScale[Automatic]]

Specify the categories and what order they should appear in:

Wolfram Language code: BarChart[{"Rudy", "Katrina", "Bob", "Katrina", "Rudy", "Michelle", "Roger", "Bob"}, ScalingFunctions -> NominalScale[{"Bob", "Katrina", "Michelle", "Roger", "Rudy"}]]

Categories that are omitted from the scale are treated as missing and are not shown:

Wolfram Language code: BarChart[{"Rudy", "Katrina", "Bob", "Katrina", "Rudy", "Michelle", "Roger", "Bob"}, ScalingFunctions -> NominalScale[{"Bob", "Katrina", "Michelle", "Roger"}]]

By default, the categories are used as labels:

Wolfram Language code: BarChart[IconizedObject[«cities»], ScalingFunctions -> NominalScale[{"Chicago", "Los Angeles", "Miami", "Dallas", "Denver", "Boston"}]]

Specify labels to use in place of the categories:

Wolfram Language code: BarChart[IconizedObject[«cities»], ScalingFunctions -> NominalScale[<|"Chicago" -> "CHI", "Los Angeles" -> "LA", "Miami" -> "MIA", "Dallas" -> "DAL", "Denver" -> "DEN", "Boston" -> "BOS"|>]]

Provide labels for individual categories:

Wolfram Language code: BarChart[IconizedObject[«cities»], ScalingFunctions -> NominalScale[Automatic, <|"Los Angeles" -> "LA"|>]]

Labels can be any type of expression:

Wolfram Language code: BarChart[IconizedObject[«cities»], ScalingFunctions -> NominalScale[<|"Chicago" -> [image], "Los Angeles" -> x ^ x ^ x, "Miami" -> [image], "Dallas" -> RGBColor[0.5, 0, 0.5], "Denver" -> [image]|>]]

Extracting Properties  (5)

Obtain a list of properties for a nominal scale:

Wolfram Language code: NominalScale[IconizedObject[«office locations»]]["Properties"]

Extract the list of categories:

Wolfram Language code: NominalScale[IconizedObject[«office locations»]]["CategoryList"]

Sort the categories alphabetically and create a new scale:

Wolfram Language code: NominalScale[AlphabeticSort[%]]

Extract the mapping between categories and labels:

Wolfram Language code: NominalScale[IconizedObject[«office locations»]]["LabelAssociation"]

Determine the label for a single category:

Wolfram Language code: NominalScale[IconizedObject[«office locations»]]["Label", "Champaign"]
Wolfram Language code: NominalScale[IconizedObject[«office locations»]]["Label"]["Champaign"]

Determine the labels for a list of categories:

Wolfram Language code: NominalScale[IconizedObject[«office locations»]]["Labels", {"Champaign", "Boston", "Lima"}]
Wolfram Language code: NominalScale[IconizedObject[«office locations»]]["Labels"][{"Champaign", "Boston", "Lima"}]

Options  (1)

RotateLabel  (1)

By default, labels are oriented horizontally:

Wolfram Language code: ListPlot[{{"Alabama ", 1}, {"Alaska ", 74}, {"Arizona ", 41}, {"Arkansas ", 9}, {"California ", 26}, {"Colorado ", 6}, {"Connecticut ", 4}, {"Delaware ", 1}, {"Florida ", 98}, {"Georgia ", 3}}, ScalingFunctions -> {NominalScale[Automatic], None}]

Rotate the tick labels for better reading:

Wolfram Language code: ListPlot[{{"Alabama ", 1}, {"Alaska ", 74}, {"Arizona ", 41}, {"Arkansas ", 9}, {"California ", 26}, {"Colorado ", 6}, {"Connecticut ", 4}, {"Delaware ", 1}, {"Florida ", 98}, {"Georgia ", 3}}, ScalingFunctions -> {NominalScale[Automatic, RotateLabel -> 90Degree], None}]

Applications  (11)

Basic Applications  (1)

Use NominalScale in a BubbleChart :

Wolfram Language code: cars = NominalScale[<|1 -> "Ford", 2 -> "Chevrolet", 3 -> "Honda", 4 -> "Toyota", 5 -> "Fiat"|>];
Wolfram Language code: state = NominalScale[<|1 -> "Illinois", 2 -> "Indiana", 3 -> "Wisconsin"|>];
Wolfram Language code: BubbleChart[Flatten /@ Tally[IconizedObject[«carsales»]], ScalingFunctions -> {state, cars, None}, ColorFunction -> "Rainbow"]

Use it in GroupBy :

Wolfram Language code: KeySort /@ GroupBy[IconizedObject[«carsales»], {state["Label", #[[1]]]&, cars["Label", #[[2]]]&}, Length]
Wolfram Language code: Dataset[%]

Agriculture  (1)

Use ParallelAxisPlot to plot multi-categorical orange wholesale data from the USDA:

Wolfram Language code: ParallelAxisPlot[IconizedObject[«orange data»], ScalingFunctions -> NominalScale[Automatic], AxesLabel -> {"Location", "Origin", "Package", "Variety", "Item Size", "Grade"}, ImageSize -> 550, LabelStyle -> 8]

Chemistry  (3)

Visualize the electrical type of a class of chemical elements:

Wolfram Language code: ListPlot[DeleteMissing[EntityValue[EntityClass["Element", "Metalloid"], {"Name", "ElectricalType"}], 1, 2], ScalingFunctions -> {NominalScale[Automatic, RotateLabel -> 90 °], NominalScale[Automatic]}, Filling -> Bottom]

Visualize the natural state of the elements:

Wolfram Language code: GraphicsColumn[Table[ListPlot[Table[{e, ElementData[e, "Phase"]}, {e, ElementData[]}], ScalingFunctions -> {NominalScale[Association[Table[e -> e["Abbreviation"], {e, elems}]]], NominalScale[<|Missing["NotAvailable"] -> "n/a", Entity["MatterPhase", "Gas"] -> "gas", Entity["MatterPhase", "Liquid"] -> "liquid", Entity["MatterPhase", "Solid"] -> "solid"|>]}, AspectRatio -> 1 / 5, Frame -> True], {elems, Partition[ElementData[], UpTo[25]]}], ImageSize -> 500]

Plot which blocks the elements are in:

Wolfram Language code: BarChart[Reverse@Table[ElementData[e, "Block"], {e, ElementData[]}], ScalingFunctions -> NominalScale[Automatic], GridLines -> Automatic, ...]

Commerce  (1)

Use ParallelAxisPlot to plot car specifications with NominalScale :

Wolfram Language code: ParallelAxisPlot[{{"Tesla Model 3", "electricity", "direct drive", 235, "All wheel drive", 4.2}, {"Toyota Camry", "hybrid", "variable-speed", 205, "Front wheel drive", 4.2}, {"Honda Accord", "hybrid", "variable-speed", 225, "Front wheel drive", 4.7}, {"Chevy Bolt", "electricity", "direct drive", 215, "Front wheel drive", 4.6}}, ScalingFunctions -> {NominalScale[Automatic], NominalScale[Automatic], NominalScale[Automatic], None, NominalScale[Automatic], None}, AxesLabel -> {"Car model", "Fuel type", "Transmission", "Tire size", "Drivetrain", "Consumer rating"}, ImageSize -> 420]

Weather  (1)

Plot types of precipitation for a couple months:

Wolfram Language code: DateListStepPlot[IconizedObject[«weather data»], ScalingFunctions -> {None, NominalScale[Automatic]}, Filling -> Bottom]

Education  (1)

Show grades for students in a classroom:

Wolfram Language code: BarChart[IconizedObject[«grades»], ScalingFunctions -> NominalScale[{1 -> "F", 2 -> "D", 3 -> "C", 4 -> "B", 5 -> "A"}], ChartLabels -> {"John", "Eric", "Rob", "Max", "Ian"}]

Biology  (1)

Plot the DNA sequence for part of a chromosome:

Wolfram Language code: ListLinePlot[Characters[GenomeData[{"ChromosomeX", {101, 161}}]], ScalingFunctions -> {None, NominalScale[{"A", "T", "G", "C"}]}, DataRange -> {101, 161}]

Social Sciences  (1)

Plot the political parties of US presidents over time:

Wolfram Language code: DateListStepPlot[TemporalData[EventSeries, {{{"None", "Federalist", "Democratic-Republican", "Democratic", "Whig", "Democratic", "Whig", "Democratic", "Republican", "National Union", "Republican", "Democratic", "Republican", "Democratic", "Republican", "D ... 1046736000, 1674172800, 1926633600, 2179094400, 2431555200, 2557785600, 2936476800, 3188937600, 3441398400, 3693859200, 3820089600}}}, 1, {"Discrete", 1}, {"Discrete", 1}, 1, {ResamplingMethod -> None, ValueDimensions -> 1}}, True, 13.1], ScalingFunctions -> NominalScale[Automatic]]

Markov Chain  (1)

Model the process of tossing a coin repeatedly, using a discrete Markov process where the probability of getting heads is 0.6 and getting tails is 0.4:

Wolfram Language code: coin = DiscreteMarkovProcess[1, {{0.6, 0.4}, {0.6, 0.4}}];

Simulate 50 coin tosses:

Wolfram Language code: tosses = RandomFunction[coin, {0, 49}]
Wolfram Language code: ListPlot[tosses, ScalingFunctions -> {None, NominalScale[<|1 -> "Head", 2 -> "Tail"|>]}, Filling -> Axis]

History

Introduced in 2022 (13.1)

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

Text

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

CMS

Wolfram Language. 2022. "NominalScale." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/NominalScale.html.

APA

Wolfram Language. (2022). NominalScale. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NominalScale.html

BibTeX

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

BibLaTeX

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

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /