Message Boards Message Boards

0
|
5724 Views
|
3 Replies
|
4 Total Likes
View groups...
Share
Share this post:

NumberLinePlot

Posted 9 years ago

I am able to use NumberLinePlot to plot the point 3 on a number line.

NumberLinePlot[3]

Notice that when it is graphed, the plot range is from 0 to 6. I would like to be able to alter the plot range to say... 2 to 20. I cannot figure out how to do this. PlotRange does not seem to work on NumberLinePlot. This seems like an option that would be included in NumberLinePlot for obvious reasons, but I can't seem to figure it out. Any help?

POSTED BY: Michael McCain
3 Replies

Thanks so much! I didn't realize InputForm did this. Thank you!

POSTED BY: Michael McCain

It appears to want the more general version of the PlotRange option (I'd consider this a small bug):

NumberLinePlot[3, PlotRange -> {{0, 20}, All}]

or

NumberLinePlot[3, PlotRange -> {{0, 20}, {0, 1}}]

and you can get an inkling of how the PlotRange option is used inside of NumberLinePlot by looking at

InputForm[NumberLinePlot[3]]

which yields

Graphics[{{RGBColor[0.24720000000000014, 0.24, 0.6], PointSize[Medium], 
   Directive[RGBColor[0.368417, 0.506779, 0.709798], AbsoluteThickness[1.6]], 
   {Point[{3, 1}]}}}, AxesLabel -> {None}, Ticks -> {Automatic, Automatic}, 
 FrameTicks -> {{Automatic, Automatic}, {Automatic, Automatic}}, 
 PlotRange -> {{0., 6.}, {0, 1}}, PlotRangePadding -> 
  {{Scaled[0.1], Scaled[0.1]}, {0, 1}}, AspectRatio -> 1/(10*GoldenRatio), 
 AxesOrigin -> {Automatic, Automatic}, Axes -> {True, False}, ImagePadding -> All, {}]
POSTED BY: David Reiss

Here is a hack until a better solution shows up

Show[NumberLinePlot[Interval[{2, 20}], PlotStyle -> White], NumberLinePlot[3]]

enter image description here

POSTED BY: Nasser M. Abbasi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract