0

I am trying to plot a bunch of particles in a box. I want the partile sizes to be scaled according to the axes length. If the particles have a radius of 1 and the box of length of 100, how do I draw this using matplotlib.pyplot.scatter()

Attempt: I have intialised the positions of the particles, such that none overlap each other. When I try to plot these using pyplot.scatter(), I find that the particle sizes(radius)are not 0.01 times the box dimesions. How do I do this?

I have attached a picture here.

If I change the box length from 100 to 1000, I expect to see the markers get their radius decrease by a factor of 10.

I'm using:

import matplotlib.pyplot
pyplot.scatter(particles_np[:,0],particles_np[:,1]) 
pyplot.show()`

particles_np is a numpy array which has the x and y positions of the particles.

  • Please show your code so that people can take a look at it – Karthik Sep 08 '20 at 16:41
  • in case you have to do it manually, https://stackoverflow.com/a/19306776/1275942 will help you get the length, and remember that particle size is specified in points**2, so if you want to make a particle with a radius of 4, you'll need to use a size of 16 – Kaia Sep 09 '20 at 04:41

0 Answers0