NumberLinePlot[{v1,v2,…}]
plots the values vi on a number line.
NumberLinePlot[pred,x]
plots a number line illustrating the region pred.
NumberLinePlot[pred,{x,xmin,xmax}]
plots the number to extend over the interval from xmin to xmax.
NumberLinePlot[{spec1,spec2,…},…]
plots several number lines.
NumberLinePlot
NumberLinePlot[{v1,v2,…}]
plots the values vi on a number line.
NumberLinePlot[pred,x]
plots a number line illustrating the region pred.
NumberLinePlot[pred,{x,xmin,xmax}]
plots the number to extend over the interval from xmin to xmax.
NumberLinePlot[{spec1,spec2,…},…]
plots several number lines.
Details and Options
- The vi can be numbers, Interval objects, Around objects or lists of these.
- The predicate pred can be any logical combination of inequalities.
- The speci can be numbers, intervals, or symbolic predicates.
- NumberLinePlot[Tabular[…]cspec] extracts and plots values from the tabular object using the column specification cspec.
- The following forms of column specifications cspec are allowed for plotting tabular data:
-
col plot values from column col {col1,col2,…,coln} plot columns {col1, …, coln} as groups of values - NumberLinePlot has the same options as Graphics, with the following additions: [List of all options]
-
AspectRatio Automatic ratio of height to width IntervalMarkers Automatic how to render uncertainty IntervalMarkersStyle Automatic style for uncertainty elements PlotLegends None legends for the sets PlotStyle Automatic graphics directives to specify styles PlotTheme $PlotTheme overall theme for the plot Spacings Automatic whether to plot different sets in the list pred at different heights - ColorData["DefaultPlotColors"] gives the default sequence of colors used by PlotStyle.
- The default setting of Spacings->Automatic evenly spaces each speci above the axis.
- Spacings->{s1,s2,…} places spec1 distance s1 from the axis, spec2 distance s2 from spec1, etc.
- Spacings->n is equivalent to Spacings->{n,n,…}
- Spacings->None places all of the speci at the same height above the axis.
- With the default setting of AspectRatio->Automatic, the ratio is chosen based on the layout of the speci.
-
AlignmentPoint Center the default point in the graphic to align with AspectRatio Automatic ratio of height to width Axes False whether to draw axes AxesLabel None axes labels AxesOrigin Automatic where axes should cross AxesStyle {} style specifications for the axes Background None background color for the plot BaselinePosition Automatic how to align with a surrounding text baseline BaseStyle {} base style specifications for the graphic ContentSelectable Automatic whether to allow contents to be selected CoordinatesToolOptions Automatic detailed behavior of the coordinates tool Epilog {} primitives rendered after the main plot FormatType TraditionalForm the default format type for text Frame False whether to put a frame around the plot FrameLabel None frame labels FrameStyle {} style specifications for the frame FrameTicks Automatic frame ticks FrameTicksStyle {} style specifications for frame ticks GridLines None grid lines to draw GridLinesStyle {} style specifications for grid lines ImageMargins 0. the margins to leave around the graphic ImagePadding All what extra padding to allow for labels etc. ImageSize Automatic the absolute size at which to render the graphic IntervalMarkers Automatic how to render uncertainty IntervalMarkersStyle Automatic style for uncertainty elements LabelStyle {} style specifications for labels Method Automatic details of graphics methods to use PlotLabel None an overall label for the plot PlotLegends None legends for the sets PlotRange All range of values to include PlotRangeClipping False whether to clip at the plot range PlotRangePadding Automatic how much to pad the range of values PlotRegion Automatic the final display region to be filled PlotStyle Automatic graphics directives to specify styles PlotTheme $PlotTheme overall theme for the plot PreserveImageOptions Automatic whether to preserve image options when displaying new versions of the same graphic Prolog {} primitives rendered before the main plot RotateLabel True whether to rotate y labels on the frame Spacings Automatic whether to plot different sets in the list pred at different heights Ticks Automatic axes ticks TicksStyle {} style specifications for axes ticks
List of all options
Examples
open all close allBasic Examples (5)
Show the first 10 prime numbers on a number line:
NumberLinePlot[Prime[Range[10]]]NumberLinePlot[Interval[{0, 1}]]Show where an inequality is true:
NumberLinePlot[Sin[x] < Cos[x], {x, 0, 2Pi}]NumberLinePlot[Interval[{0, ∞}]]Show several sets on a single number line:
NumberLinePlot[{Range[20], 2Range[10], 3Range[6], 5Range[4], 7 Range[2]}]Scope (9)
Data (7)
NumberLinePlot[{{Interval[{0, 1}]}, Interval[{0, 2}]}]Use Interval and single points:
NumberLinePlot[{Interval[{0, 1}], 2, Interval[{0, 2}]}]Group intervals and points into a single list to represent a single set:
NumberLinePlot[{{Interval[{0, 1}], 2}, Interval[{0, 2}]}]NumberLinePlot[0 < x ≤ 1, x]Use a logical conjunction of equalities and inequalities:
NumberLinePlot[-2 ≤ x < 1 || x == 2 || x > 3, x]Use a list to represent more than one set:
NumberLinePlot[{-2 ≤ x < 1 || x > 3, x == 2}, x]Use a more complicated inequality:
NumberLinePlot[x ^ 3 < Sin[13x], x]Tabular Data (1)
tabular = ResourceData["Sample Tabular Data: Fisher Iris"]Plot petal length in a number line:
NumberLinePlot[tabular -> "PetalLength"]Plot elements of both petal and sepal Length as separate number lines:
NumberLinePlot[tabular -> {"PetalLength", "SepalLength"}]Include a legend for the plot:
NumberLinePlot[tabular -> {"PetalLength", "SepalLength"}, PlotLegends -> {"petal", "sepal"}]Create columns of petal length per species:
pivot = PivotToColumns[tabular, "Species" -> "PetalLength"]Plot petal lengths grouped by species:
NumberLinePlot[pivot -> {"setosa", "versicolor", "virginica"}, PlotLegends -> {"setosa", "versicolor", "virginica"}]Options (43)
AspectRatio (4)
By default, the ratio of the height to width for the plot is determined automatically:
NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}]Make the height the same as the width with AspectRatio1:
NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}, AspectRatio -> 1]Use numerical value to specify the height-to-width ratio:
NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}, AspectRatio -> 1 / 2]AspectRatioFull adjusts the height and width to tightly fit inside other constructs:
plot = NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}, AspectRatio -> Full];{Framed[Pane[plot, {50, 100}]], Framed[Pane[plot, {100, 100}]], Framed[Pane[plot, {100, 50}]]}Axes (2)
AxesLabel (2)
AxesStyle (4)
Change the style for the axes:
NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}, AxesStyle -> Red]Specify the style of each axis:
NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}, AxesStyle -> Directive[Thick, Red]]Use different styles for the ticks and the axes:
NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}, AxesStyle -> Green, TicksStyle -> StandardGray]Use different styles for the labels and the axes:
NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}, AxesStyle -> Green, LabelStyle -> StandardGray]ImageSize (7)
Use named sizes such as Tiny, Small, Medium and Large:
{NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}, ImageSize -> Tiny], NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}, ImageSize -> Small]}Specify the width of the plot:
{NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}, ImageSize -> 150], NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}, AspectRatio -> 1.5, ImageSize -> 150]}Specify the height of the plot:
{NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}, ImageSize -> {Automatic, 50}], NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}, AspectRatio -> 2, ImageSize -> {Automatic, 50}]}Allow the width and height to be up to a certain size:
{NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}, ImageSize -> UpTo[200]], NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}, AspectRatio -> 2, ImageSize -> UpTo[200]]}Specify the width and height for a graphic, padding with space if necessary:
NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}, ImageSize -> {200, 200}, Background -> StandardBrown]Setting AspectRatioFull will fill the available space:
NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}, AspectRatio -> Full, ImageSize -> {200, 200}, Background -> StandardBrown]Use maximum sizes for the width and height:
{NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}, ImageSize -> {UpTo[150], UpTo[100]}], NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}, AspectRatio -> 2, ImageSize -> {UpTo[150], UpTo[100]}]}Use ImageSizeFull to fill the available space in an object:
Framed[Pane[NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}, ImageSize -> Full, Background -> StandardBrown], {200, 100}]]Specify the image size as a fraction of the available space:
Framed[Pane[NumberLinePlot[{x^2 > 1, Tan[x] ≠ 0, Sin[x] > 0}, {x, -7, 7}, AspectRatio -> Full, ImageSize -> {Scaled[0.5], Scaled[0.5]}, Background -> StandardBrown], {200, 100}]]PlotLegends (7)
By default, no legends are used:
NumberLinePlot[{x < 0, x > 0}, x]Create a legend based on the expressions:
NumberLinePlot[{x < 0, x > 0}, x, PlotLegends -> "Expressions"]Create a legend with placeholder text:
NumberLinePlot[{x < 0, x > 0}, x, PlotLegends -> Automatic]Create a legend with specific labels:
NumberLinePlot[{x < 0, x > 0}, x, PlotLegends -> {"one", "two"}]PlotLegends picks up PlotStyle values automatically:
NumberLinePlot[{x < 1, x > 1}, x, PlotStyle -> {{Red, Dashed}, Blue}, PlotLegends -> Automatic]Use Placed to position legends:
NumberLinePlot[{x < 1, x > 1}, x, PlotLegends -> Placed[Automatic, Below]]Use LineLegend to modify the appearance of the legend:
NumberLinePlot[{x < 1, x > 1}, x, PlotLegends -> LineLegend["Expressions", LegendFunction -> "Frame"]]PlotRange (2)
PlotRange is automatically calculated:
NumberLinePlot[Range@10]NumberLinePlot[Range@10, PlotRange -> {{4, 6}, All}]PlotStyle (3)
By default, different styles are chosen for multiple curves:
NumberLinePlot[Table[x ^ 2 > k, {k, 0, 5}], x]Explicitly specify the style for different curves:
NumberLinePlot[Table[x ^ 2 > k, {k, 0, 5}], x, PlotStyle -> {Red, Blue, Green}]Specify styles for the endpoints:
NumberLinePlot[{x == 0 || 1 < x ≤ 2, 0 ≤ x < 1 || x == 2}, x, PlotStyle -> {Directive[Thick, Red, PointSize[Large]], Directive[Dashed, Blue, PointSize[Medium]]}, AspectRatio -> 1 / 4]PlotTheme (1)
Use a theme with simple ticks and bright colors:
NumberLinePlot[Table[x ^ 2 > k, {k, 0, 5}], x, PlotTheme -> "Business"]Add another theme with legends:
NumberLinePlot[Table[x ^ 2 > k, {k, 0, 5}], x, PlotTheme -> {"Detailed", "Business"}]NumberLinePlot[Table[x ^ 2 > k, {k, 0, 5}], x, PlotTheme -> {"Detailed", "Business"}, PlotStyle -> {RGBColor[0.468742, 0., 0.0158236], RGBColor[0.7514516, 0.09778, 0.0063294399999999995], RGBColor[0.9108294, 0.2745386, 0.020955220000000004], RGBColor[0.9819778, 0.4844202000000001, 0.05144122000000002], RGBColor[1., 0.6815686, 0.08952772000000002], RGBColor[1., 0.820127, 0.126955]}]Spacings (4)
By default, sets are evenly spaced above the axis:
NumberLinePlot[{x ^ 2 > 1, x ^ 2 > 3}, {x, -4, 4}]Use Spacings->None to place the sets on top of one another:
NumberLinePlot[{x ^ 2 > 1, x ^ 2 > 3}, {x, -4, 4}, Spacings -> None]Use Spacings->0 to place all the sets on the axis:
NumberLinePlot[{x ^ 2 > 1, x ^ 2 > 3}, {x, -4, 4}, Spacings -> 0]Place the second set close to the first set:
NumberLinePlot[{x ^ 2 > 1, x ^ 2 > 3}, {x, -4, 4}, Spacings -> {1, 0.5}]Ticks (4)
Ticks are placed automatically in each plot:
NumberLinePlot[Table[x ^ 2 > k, {k, 0, 5}], x]Use TicksNone to not draw any tick marks:
NumberLinePlot[Table[x ^ 2 > k, {k, 0, 5}], x, Ticks -> None]Place tick marks at specific positions:
NumberLinePlot[Table[x ^ 2 > k, {k, 0, 5}], x, Ticks -> {{-2, 0, 2}, Automatic}]Draw tick marks at the specified positions with the specified labels:
NumberLinePlot[Table[x ^ 2 > k, {k, 0, 5}], x, Ticks -> {{{-2, -a}, {0, b}, {2, a}}, Automatic}]TicksStyle (3)
Specify overall ticks style, including the tick labels:
NumberLinePlot[Table[x ^ 2 > k, {k, 0, 5}], x, TicksStyle -> Directive[Red, 12]]Specify tick marks with scaled lengths:
NumberLinePlot[Table[x ^ 2 > k, {k, 0, 5}], x, Ticks -> {{{-2, -a, .1}, {0, b, .05}, {2, a, .25}}, Automatic}]Customize each tick with position, length, labeling and styling:
NumberLinePlot[Table[x ^ 2 > k, {k, 0, 5}], x, Ticks -> {{{-2, -a, .15, Directive[Thick, Darker@Green]}, {0, b, .05, Directive[Blue]}, {2, a, .25, Directive[Dashed, Thick, Purple]}}, Automatic}]Applications (6)
Illustrate the domain of a function:
FunctionDomain[Sqrt[1 - x ^ 2], x]NumberLinePlot[%, x]Illustrate the Range of a function:
FunctionRange[(E^x/x), x, y]NumberLinePlot[%, {y, -5, 5}]Visualize the accumulation points of a sequence on the real line:
ϕ[n_] := Cos[Pi n]ArcTan[n](2 / Pi + Sin[n] / n)NumberLinePlot[{Table[ϕ[n], {n, 1, 300}]}, PlotStyle -> Directive[StandardGreen, PointSize[Small], Opacity[.2]]]Show where a function is increasing or decreasing:
f[x_] := 2x ^ 3 + 3x ^ 2 - 12x + 5Show[{Plot[f[x], {x, -3, 3}, PlotStyle -> StandardGray], NumberLinePlot[{Derivative[1][f][x] > 0, Derivative[1][f][x] < 0, Derivative[1][f][x] == 0}, {x, -3, 3}, PlotStyle -> {Red, Blue, StandardGray}, Spacings -> 0, PlotLegends -> {"Increasing", "Decreasing", "Stationary"}]}]Visualize the construction of the Cantor set:
NumberLinePlot[NestList[# /. {a_, b_} :> Sequence[{a, 0.6 a + 0.4 b}, {0.4 a + 0.6 b, b}]&, Interval[{0, 1}], 5], {x, 0, 1}, AspectRatio -> 1, PlotStyle -> PointSize[0], PlotRangePadding -> Scaled[0.1]]Illustrate the not-so-trivial history of Albert Einstein's citizenship:
data = {{Interval[{1879, 1896}], "Kingdom of Württemberg - German Empire"}, {Interval[{1896, 1901}], "Stateless"}, {Interval[{1901, 1955}], "Switzerland"}, {Interval[{1911, 1912}], "Austria - Austro-Hungarian Empire"}, {Interval[{1914, 1918}], "Kingdom of Prussia - German Empire"}, {Interval[{1918, 1933}], "Free State of Prussia - Weimar Republic"}, {Interval[{1940, 1955}], "United States"}};NumberLinePlot[data[[All, 1]], PlotLegends -> data[[All, -1]], AspectRatio -> .7]Properties & Relations (3)
Use RegionPlot and RegionPlot3D for showing higher-dimensional regions:
{NumberLinePlot[Norm[{x}] ≤ 1, {x, -2, 2}], RegionPlot[Norm[{x, y}] ≤ 1, {x, -2, 2}, {y, -2, 2}], RegionPlot3D[Norm[{x, y, z}] ≤ 1, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}]}Use ListPlot and ListLinePlot to show numbers as a list of heights:
{NumberLinePlot[Prime[Range[10]]], ListPlot[Prime[Range[10]]], ListLinePlot[Prime[Range[10]]]}Use RadialAxisPlot and ParallelAxisPlot to display multidimensional points:
{NumberLinePlot[{1, 2, 5, 3, 7}], RadialAxisPlot[{1, 2, 5, 3, 7}], ParallelAxisPlot[{1, 2, 5, 3, 7}]}See Also
ListPlot RegionPlot Graphics DateListPlot Interval FunctionDomain FunctionRange TimelinePlot RadialAxisPlot ParallelAxisPlot
Function Repository: TapeDiagram
Related Guides
History
Introduced in 2014 (10.0) | Updated in 2019 (12.0) ▪ 2025 (14.2)
Text
Wolfram Research (2014), NumberLinePlot, Wolfram Language function, https://reference.wolfram.com/language/ref/NumberLinePlot.html (updated 2025).
CMS
Wolfram Language. 2014. "NumberLinePlot." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/NumberLinePlot.html.
APA
Wolfram Language. (2014). NumberLinePlot. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NumberLinePlot.html
BibTeX
@misc{reference.wolfram_2026_numberlineplot, author="Wolfram Research", title="{NumberLinePlot}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/NumberLinePlot.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_numberlineplot, organization={Wolfram Research}, title={NumberLinePlot}, year={2025}, url={https://reference.wolfram.com/language/ref/NumberLinePlot.html}, note=[Accessed: 12-June-2026]}