       Re: Controlling the scale of x-axis in ListPlot

• To: mathgroup at smc.vnet.net
• Subject: [mg119367] Re: Controlling the scale of x-axis in ListPlot
• From: Murray Eisenberg <murray at math.umass.edu>
• Date: Wed, 1 Jun 2011 04:31:26 -0400 (EDT)

```I think what you're really asking is how to plot the vector
{y_1,...,y_n} against {1,...,n} but to label the x-coordinates with the
vector {x_1,..,x_n}. If so, here's a way, using your example for x:

x = {1, 2, 10};
y = RandomReal[{0, 1}, 3]

xTicks = Transpose[{Range[Length@x], x}]
ListPlot[y, PlotStyle -> PointSize[Large],
Ticks -> {xTicks, Automatic}]

On 5/31/2011 7:48 AM, daniel.andersson at bwinparty.com wrote:
> Hi,
>
> I need to plot two a vector {y_1,...,y_n} against a vector {x_1,...,x_n} and I want to the latter to be distributed with equal distances between the elements. Mathematica automatically scales the x-axis so that it is linear with respect to the x-values, i.e. if x={1,2,10}, then the distance between the second and third element will be eight times longer than the distance between the second and first element. I would like the distances to be of equal length.
>
> Any ideas?
>
> Cheers,
> Daniel
>

--
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305

```

• Prev by Date: Re: FixedPoint[Cos, 1.0]
• Next by Date: Re: Parallelize vs Compile
• Previous by thread: Re: Controlling the scale of x-axis in ListPlot
• Next by thread: Re: Controlling the scale of x-axis in ListPlot