7
$\begingroup$

I am using 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

enter image description here

Question:

Is it possible to have a plot without any endpoints markers (I mean only a solid line of the intervals)? something like this picture enter image description here

$\endgroup$

1 Answer 1

7
$\begingroup$

1. You can add PointSize[0] inside Directive when setting PlotStyle:

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

enter image description here

2. You can post-process to remove Points:

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

enter image description here

3. Use ReplaceAll[ _Point -> Nothing] as the option value for DisplayFunction:

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

enter image description here

4. Use LineOpacity -> 1 (to make lines rendered with opacity 1) and Opacity -> 0 (to make all other primitives invisible) inside Directive when setting PlotStyle:

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

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.