py-sphviewer icon indicating copy to clipboard operation
py-sphviewer copied to clipboard

empty plots with large number of particles

Open jegarfa opened this issue 1 year ago • 3 comments

Hi! I'm trying to plot a DM-only simulation using py-sphviewer. The simulation consists of 2048^3 particles. However, the result I'm getting is either a completely white or black plot. Below is the code, which I've taken from the examples.

Particles = sph.Particles(pos, mass, nb=4)
hsml      = Particles.get_hsml()
Scene     = sph.Scene(Particles)

fig = plt.figure(1, figsize=(15,7))
ax1 = fig.add_subplot(111)
ax1.imshow(qv_perspective.get_image(), extent=qv_perspective.get_extent(),
           origin='lower', cmap=cmaps.twilight(), 
           vmin=-0.5)
plt.show()

When I plot smaller simulations, everything works fine, and I get pretty plots. I suspect this issue might not be related to py-sphviewer but rather to matplotlib. I've noticed that when I create a simple 2D scatter plot with matplotlib for the 2048^3 particles (x, y), it results in an empty figure. So, I do not get errors, only empty plots.

Have you ever faced a similar issue when plotting large amounts of data? do you have any hint on what could be causing the problem?
thanks,

jegarfa avatar May 17 '24 19:05 jegarfa