# Is it possible to change the endpoints marker in NumberLinePlot in the given code?

I use this code

list :=  {Interval[{ 1 , 1.5  }], Interval[{ 3.9 , 5.1 }], Interval[{ 5.7 ,6.7 }], Interval[{ 7.5 , 9.8 }] } ;

NumberLinePlot[list, Spacings -> Prepend[0.2]@ConstantArray[.0, Length@list], PlotStyle -> Directive[Black, Thickness[0.001]]]


and I get this plot

Question:

Is it possible to change the endpoints marker from "solid points" to "small vertical line"? something like this picture

• NumberLinePlot[list, Spacings -> Prepend[0.2]@ConstantArray[.0, Length@list], PlotStyle -> Directive[Black, Thickness[0.001]]] /. Point[{x_, y_}] :> Line[{{x, y - 0.03}, {x, y + 0.03}}] Feb 8, 2022 at 4:39

verticalLine[voffset_: 3] := Line[Table[Offset[{0, voffset i}, #], {i, {-1, 1}}]] &

displayF[voffset_: 3] := ReplaceAll[wp : {White, ___, _Point} :>
(wp /. Point -> verticalLine[voffset/4]),
Point -> verticalLine[voffset]}];


Examples:

list := {Interval[{1, 1.5}], Interval[{3.9, 5.1}],
Interval[{5.7, 6.7}], Interval[{7.5, 9.8}]};

NumberLinePlot[list,
Spacings -> Prepend[0.2] @ ConstantArray[.0, Length @ list],
PlotStyle -> Directive[Black, Thickness[0.001]],
DisplayFunction -> displayF[]]


An example with half-open intervals:

nlp = NumberLinePlot[{Sin[x] < Cos[x], Sin[x] > Cos[x], 1 < x <= 3}, {x, 0, 2 Pi},
PlotStyle -> Directive[AbsoluteThickness[3], AbsolutePointSize[10]],
ImageSize -> Large]


Show[nlp, DisplayFunction -> displayF[7]]