0
$\begingroup$

Up to this point, my function looked like:

plotParticles[particles_, noOfParticles_, time_, range_] := 
   ListPlot[{x[t], y[t]} /. 
     getPath[getTrajectory[particles[[#]]]] /. 
       t -> time & /@ Range[1, noOfParticles], 
   AspectRatio -> 1, 
   PlotRange -> {{-range, range}, {-range, range}}, 
   FrameLabel -> {"x", "y"}]

particles is of the format:

{{name of particle, mass of particle, color, Trajectory}, {..} , ..}, 

where

getTrajectory[particle_] := particle[[4]]. 

Also, not all of the particles are the same — every type has assigned different color and mass.

The code is supposed to plot position of number of particles at some time t. It works fine, but now I'm trying to color every point on the plot with the color assigned to it. I would appreciate any help.

$\endgroup$
  • 3
    $\begingroup$ Try this. If that doesn't do it we may need a small sample data set to give a better answer. $\endgroup$ – Jason B. Dec 3 '18 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.