[Date Index]
[Thread Index]
[Author Index]
Re: Plot a number line
*To*: mathgroup at smc.vnet.net
*Subject*: [mg79744] Re: [mg79687] Plot a number line
*From*: Selwyn Hollis <selwynh at earthlink.net>
*Date*: Fri, 3 Aug 2007 06:28:42 -0400 (EDT)
*References*: <200708020741.DAA00009@smc.vnet.net>
Here's one possibility, but you have to fiddle with the endpoints of
the arrow to make them coincide with the axis endpoints.
Plot[Infinity, {x, -11, 11},
Axes -> {True, False},
Ticks -> {Range[-10, 10], {}},
AspectRatio -> Automatic,
Epilog -> {Arrowheads[{-.033, .033}], AbsoluteThickness[.5],
Arrow[{{-11.5, 0}, {11.5, 0}}]}]
So I decided to build it from scratch:
axisPlot[a_, b_, incr_: 1] := Show[
(* minor ticks *)
If[(b - a)/incr < 15,
Graphics[{Gray,
Table[Line[{{x, 0}, {x, .005 (b - a)}}], {x, a, b, incr/
10}]} ], {} ],
(* major ticks *)
Graphics[Table[Line[{{x, 0}, {x, .01 (b - a)}}], {x, a, b, incr}] ],
(* tick labels *)
Graphics[Table[Text[Chop[x], {x, -.025 (b - a)}], {x, a, b, incr}] ],
(* double-headed arrow *)
Graphics[{Arrowheads[{-.033, .033}], AbsoluteThickness[.5],
Arrow[{{a - .067 (b - a), 0}, {b + .067 (b - a), 0}}]} ],
Axes -> None, AspectRatio -> Automatic]
axisPlot[0, 1, .1]
axisPlot[-10,10]
-- Selwyn Hollis
On Aug 2, 2007, at 3:41 AM, Diana wrote:
> Math folks,
>
> I am trying to plot just an x axis number line with varying end
> points.
>
> For example, I would like a number line with starting and ending
> arrows pointing to negative and positive infinity, with the numbers
> -10, -9, ..., 8, 9, 10 printed on the line. I would like just the tick
> marks at integer markings. This is meant to be a template for students
> to graph the solution set to an inequality on it.
>
> Can someone help?
>
> Thanks,
>
> Diana M.
>
>
Prev by Date:
**Re: Differentiation w.r.t. elements of lists**
Next by Date:
**Memmory issue while batch exporting graphics**
Previous by thread:
**Plot a number line**
Next by thread:
**Re: Plot a number line**
| |