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


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

List plot with random size for each point

Started byRudresh <rudresh@email.unc.edu>
First post2011-10-28 09:45 +0000
Last post2011-10-29 11:09 +0000
Articles 2 — 2 participants

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


Contents

  List plot with random size for each point Rudresh <rudresh@email.unc.edu> - 2011-10-28 09:45 +0000
    Re: List plot with random size for each point Ray Koopman <koopman@sfu.ca> - 2011-10-29 11:09 +0000

#5969 — List plot with random size for each point

FromRudresh <rudresh@email.unc.edu>
Date2011-10-28 09:45 +0000
SubjectList plot with random size for each point
Message-ID<j8dtjl$kgs$1@smc.vnet.net>
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] | [next] | [standalone]


#5990

FromRay Koopman <koopman@sfu.ca>
Date2011-10-29 11:09 +0000
Message-ID<j8gmt0$54a$1@smc.vnet.net>
In reply to#5969
On Oct 28, 2:45 am, Rudresh <rudr...@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]]

n = 200
particle = Transpose@{Range[n],
                      RandomInteger[{15,25},n],
                      RandomInteger[{0,200},n],
                      RandomInteger[{0,200},n]};
Show[Graphics[{PointSize[#2*.001],Point@{#3,#4}}& @@@ particle],
Frame->True, PlotRange->{{-5,205},{-5,205}}, AspectRatio->Automatic]

[toc] | [prev] | [standalone]


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


csiph-web