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


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

Re: List plot with random size for each point

Started byHeike Gramberg <heike.gramberg@gmail.com>
First post2011-10-29 11:15 +0000
Last post2011-10-29 11:15 +0000
Articles 1 — 1 participant

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

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: List plot with random size for each point Heike Gramberg <heike.gramberg@gmail.com> - 2011-10-29 11:15 +0000

#5984 — Re: List plot with random size for each point

FromHeike Gramberg <heike.gramberg@gmail.com>
Date2011-10-29 11:15 +0000
SubjectRe: List plot with random size for each point
Message-ID<j8gn9f$5cq$1@smc.vnet.net>
I'm not entirely sure what you mean with the last line. Do you want the 
PointSize of the point at position position[[n]] to be equal to 
particle[[n,2]]?
If so, you could do something like

Graphics[MapThread[{AbsolutePointSize[#1/3], Point[#2]} &, 
{particle[[All,2]], position}], Axes -> True]

By the way, a more typical way in Mathematica to generate the lists 
particle and position as in your example is to do something like

particle = Table[{i, RandomInteger[{15, 25}], RandomInteger[{0, 200}], 
RandomInteger[{0, 200}]}, {i, 200}];
position = particle[[All, {3, 4}]];

Heike.


On 28 Oct 2011, at 11:36, Rudresh wrote:

> I want to plot an array of numbers on a 2d plot, however each point 
has a random number associated with it which should be its size on the 
plot. Can this be done in mathematica and if so how. My code as of now 
is:
>
> =========================
>
> particle = Array[f, {200, 4}];
> position = Array[g, {200, 2}];
> n = 1;
> While  [n < 201,
>  	particle[[n, 1]] = n;
>  	particle[[n, 2]] = RandomInteger[{15, 25}];
>  	particle[[n, 3]] = RandomInteger[{0, 200}];
>  	particle[[n, 4]] = RandomInteger[{0, 200}];
>  
>  position[[n, 1]] = particle[[n, 3]];
>  position[[n, 2]] = particle[[n, 4]];
>  n++
>  ];
>
> ListPlot[position, PlotStyle -> PointSize[0.01],
> PlotRange -> {{0, 200}, {0, 200}}]
>
> =========================
>
> I want particle[[n,2]] to be the size of position[[n,1],[n,2]]
>

[toc] | [standalone]


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


csiph-web