Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #2827 > unrolled thread

Controlling the scale of x-axis in ListPlot

Started by"daniel.andersson@bwinparty.com" <daniel.andersson@bwinparty.com>
First post2011-05-31 11:48 +0000
Last post2011-06-01 08:32 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Controlling the scale of x-axis in ListPlot "daniel.andersson@bwinparty.com" <daniel.andersson@bwinparty.com> - 2011-05-31 11:48 +0000
    Re: Controlling the scale of x-axis in ListPlot Peter Breitfeld <phbrf@t-online.de> - 2011-06-01 08:30 +0000
    Re: Controlling the scale of x-axis in ListPlot Rolf Schramek <subirolf@googlemail.com> - 2011-06-01 08:32 +0000

#2827 — Controlling the scale of x-axis in ListPlot

From"daniel.andersson@bwinparty.com" <daniel.andersson@bwinparty.com>
Date2011-05-31 11:48 +0000
SubjectControlling the scale of x-axis in ListPlot
Message-ID<is2kj4$qr3$1@smc.vnet.net>
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

[toc] | [next] | [standalone]


#2844

FromPeter Breitfeld <phbrf@t-online.de>
Date2011-06-01 08:30 +0000
Message-ID<is4tad$auj$1@smc.vnet.net>
In reply to#2827
You can change the Ticks:

yList = RandomInteger[{1, 5}, 10]
xList = RandomInteger[{1, 100}, 10] // Sort

xTicks = Table[{i, xList[[i]]}, {i, 1, Length[xList]}]
ListPlot[yList, Ticks -> {xTicks, Automatic}]


"daniel.andersson@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

-- 
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de

[toc] | [prev] | [next] | [standalone]


#2858

FromRolf Schramek <subirolf@googlemail.com>
Date2011-06-01 08:32 +0000
Message-ID<is4tfc$b31$1@smc.vnet.net>
In reply to#2827
On 31 Mai, 13:48, "daniel.anders...@bwinparty.com"
<daniel.anders...@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

Hello,

this might work:

y = {1, 3, 0, -4}
x = {1, 2, 10, 50}
ListPlot[y
 , PlotStyle -> PointSize[0.03]
 , Ticks -> {Transpose[{Range[Length[y]], x}], Automatic}
 ]

Greetings

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web