Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: List plot with random size for each point

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122478] Re: List plot with random size for each point
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Sat, 29 Oct 2011 07:13:56 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201110280936.FAA20855@smc.vnet.net>

numberOfPoints = 20;

particle = Table[
   {n, RandomInteger[{15, 25}],
    RandomInteger[{0, 200}], RandomInteger[{0, 200}]},
   {n, numberOfPoints}];

Graphics[
 {AbsolutePointSize[#[[2]]], Point[#[[{3, 4}]]],
    White, Text[#[[1]], #[[{3, 4}]]]} & /@
  particle,
 Frame -> True,
 PlotRange -> {{-12, 213}, {-12, 213}},
 ImageSize -> 500]


Bob Hanlon


On Fri, Oct 28, 2011 at 5:36 AM, Rudresh <rudresh at email.unc.edu> 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]]
>



  • Prev by Date: When exactly is an Initialization (for Dynamic, Module, etc.) evaluated?
  • Next by Date: Re: List plot with random size for each point
  • Previous by thread: List plot with random size for each point
  • Next by thread: Re: List plot with random size for each point