({{, (RefLink[NumberLinePlot, paclet:ref/NumberLinePlot])[{(Subscript[v, 1]),(Subscript[v, 2]),…}]
plots the values (Subscript[v, i]) on a number line.}, {, (RefLink[NumberLinePlot, paclet:ref/NumberLinePlot])[pred,x] 
plots a number line illustrating the region pred.}, {, (RefLink[NumberLinePlot, paclet:ref/NumberLinePlot])[pred,{x,(Subscript[x, min]),(Subscript[x, max])}]
plots the number to extend over the interval from (Subscript[x, min]) to (Subscript[x, max]).}, {, (RefLink[NumberLinePlot, paclet:ref/NumberLinePlot])[{(Subscript[spec, 1]),(Subscript[spec, 2]),…},…]
plots several number lines.}})

OpenersNotesSection(Spacer1)Details and Options

The (Subscript[v, i]) can be numbers, (RefLink[Interval, paclet:ref/Interval]) objects, (RefLink[Around, paclet:ref/Around]) objects or lists of these.

The predicate pred can be any logical combination of inequalities.

The (Subscript[spec, i]) can be numbers, intervals, or symbolic predicates.

(RefLink[NumberLinePlot, paclet:ref/NumberLinePlot]) has the same options as (RefLink[Graphics, paclet:ref/Graphics]), with the following additions:

The default setting of (RefLink[Spacings, paclet:ref/Spacings])->(RefLink[Automatic, paclet:ref/Automatic]) evenly spaces each (Subscript[spec, i]) above the axis.

(RefLink[Spacings, paclet:ref/Spacings])->{(Subscript[s, 1]),(Subscript[s, 2]),…} places (Subscript[spec, 1]) distance (Subscript[s, 1]) from the axis, (Subscript[spec, 2]) distance (Subscript[s, 2]) from (Subscript[spec, 1]), etc.

(RefLink[Spacings, paclet:ref/Spacings])->n is equivalent to (RefLink[Spacings, paclet:ref/Spacings])->{n,n,…}

(RefLink[Spacings, paclet:ref/Spacings])->(RefLink[None, paclet:ref/None]) places all of the (Subscript[spec, i]) at the same height above the axis.

With the default setting of (RefLink[AspectRatio, paclet:ref/AspectRatio])->(RefLink[Automatic, paclet:ref/Automatic]), the ratio is chosen based on the layout of the (Subscript[spec, i]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (35)

OpenersExampleSection0(Spacer1)Basic Examples  (5)

Show the first 10 prime numbers on a number line:

NumberLinePlot[Prime[Range[10]]]

Display an interval:

NumberLinePlot[Interval[{0,1}]]

Show where an inequality is true:

NumberLinePlot[Sin[x]<Cos[x],{x,0,2Pi}]

Show an infinite interval:

NumberLinePlot[Interval[{0,∞}]]

Show several sets on a single number line:

NumberLinePlot[{Range[20],2Range[10],3Range[6],5Range[4],7 Range[2]}]

OpenersExampleSection1(Spacer1)Scope  (8)

OpenersExampleSubsection0(Spacer1)Data  (7)

Show multiple sets:

NumberLinePlot[{{Interval[{0,1}]},Interval[{0,2}]}]

Use (RefLink[Interval, paclet:ref/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}]}]

Use an inequality:

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]

OpenersExampleSubsection1(Spacer1)Presentation  (1)

Use a theme with dark background and high-contrast colors:

NumberLinePlot[{x>0,x==0,x<0},x,PlotTheme->"Marketing"]

Use a theme with detailed information:

NumberLinePlot[{x>0,x==0,x<0},x,PlotTheme->"Detailed"]

OpenersExampleSection2(Spacer1)Options  (15)

OpenersExampleSubsection2(Spacer1)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"}]

(RefLink[PlotLegends, paclet:ref/PlotLegends]) picks up (RefLink[PlotStyle, paclet:ref/PlotStyle]) values automatically:

NumberLinePlot[{x<1,x>1},x,PlotStyle->{{Red,Dashed},Blue},PlotLegends->Automatic]

Use (RefLink[Placed, paclet:ref/Placed]) to position legends:

NumberLinePlot[{x<1,x>1},x,PlotLegends->Placed[Automatic,Below]]

Use (RefLink[LineLegend, paclet:ref/LineLegend]) to modify the appearance of the legend:

NumberLinePlot[{x<1,x>1},x,PlotLegends->LineLegend["Expressions",LegendFunction->Frame]]

OpenersExampleSubsection3(Spacer1)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]

OpenersExampleSubsection4(Spacer1)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"}]

Change the colors:

NumberLinePlot[Table[x^2>k,{k,0,5}],x,PlotTheme->{"Detailed","Business"},PlotStyle->96]

OpenersExampleSubsection5(Spacer1)Spacings  (4)

By default, sets are evenly spaced above the axis:

NumberLinePlot[{x^2>1,x^2>3},{x,-4,4}]

Use (RefLink[Spacings, paclet:ref/Spacings])->(RefLink[None, paclet:ref/None]) to place the sets on top of one another:

NumberLinePlot[{x^2>1,x^2>3},{x,-4,4}, Spacings->None]

Use (RefLink[Spacings, paclet:ref/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}]

OpenersExampleSection3(Spacer1)Applications  (5)

Illustrate the domain of a function:

FunctionDomain[Sqrt[1-x^2],x]

NumberLinePlot[%,x]

Illustrate the (RefLink[Range, paclet:ref/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[Black,PointSize[Small],Opacity[.2]]]

Show where a function is increasing or decreasing:

f[x_]:=2x^3+3x^2-12x+5

Show[{Plot[f[x],{x,-3,3},PlotStyle->Black],NumberLinePlot[{f'[x]>0,f'[x]<0,f'[x]==0},{x,-3,3},PlotStyle->{Red,Blue,Black},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]]

OpenersExampleSection4(Spacer1)Properties & Relations  (2)

Use (RefLink[RegionPlot, paclet:ref/RegionPlot]) and (RefLink[RegionPlot3D, paclet:ref/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 (RefLink[ListPlot, paclet:ref/ListPlot]) and (RefLink[ListLinePlot, paclet:ref/ListLinePlot]) to show numbers as a list of heights:

{NumberLinePlot[Prime[Range[10]]],ListPlot[Prime[Range[10]]],ListLinePlot[Prime[Range[10]]]}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ListPlot, paclet:ref/ListPlot])  ▪  (RefLink[RegionPlot, paclet:ref/RegionPlot])  ▪  (RefLink[Graphics, paclet:ref/Graphics])  ▪  (RefLink[DateListPlot, paclet:ref/DateListPlot])  ▪  (RefLink[Interval, paclet:ref/Interval])  ▪  (RefLink[FunctionDomain, paclet:ref/FunctionDomain])  ▪  (RefLink[FunctionRange, paclet:ref/FunctionRange])  ▪  (RefLink[TimelinePlot, paclet:ref/TimelinePlot])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Data Visualization, paclet:guide/DataVisualization])}, {▪(RefLinkPlain[Function Visualization, paclet:guide/FunctionVisualization])}})}})

({{(Spacer1), ({{(Spacer1)Related Links}, {(WebLink[DocumentationFooterIconsRelatedLinks-EIWL.png(Spacer1)An Elementary Introduction to the Wolfram Language, https://www.wolfram.com/language/elementary-introduction/04-displaying-lists.html])(WebLink[: Displaying Lists, https://www.wolfram.com/language/elementary-introduction/04-displaying-lists.html])}})}})