# Plotting galaxies in 3-D

Suppose I have a catalogue of galaxies in a .dat file with each row representing information about a galaxy: right ascension of the galaxy, declination of the galaxy, redshift of the galaxy, comoving distance to the galaxy, r-band absolute magnitude of the galaxy, g-r band color of the galaxy and equatorial $$x$$, $$y$$ and $$z$$ co-ordinates of the galaxy.

Now my task is to plot these galaxies in 3-D with Earth as the center, so I am imagining the celestial sphere. But I don't understand how to factor redshift/comoving distance/Hubble constant in all of this. Can I just plot using the equatorial $$x$$, $$y$$ and $$z$$ co-ordinates? The direct coordinate transformation from equatorial co-ordinates to ra and dec using comoving distance as $$r$$ does not give the correct answer (I don't quite understand how it relates to redshift and proper distance, or is it already factored into the $$x$$, $$y$$ and $$z$$ co-ordinates)?

The actual plotting should then be not hard, as I understand there are a lot of ways in Python to do that, so I just want some explanation on how to factor the comoving and proper distances. Also it would be really nice if someone can tell me what r-band and g-r band color mean.

Update #1: I am attaching the plot I got from ploty library of matplotlib. You can make out the solid angle like of shape from here because it is a catalogue of galaxies lying in a part of the sky (angular size, basically).

So I now have two questions:

1. Each of the point (~80k) represents a galaxy. Is it correct to use the $$x$$, $$y$$ and $$z$$ co-ordinates here (whose units are in Mpc/h)?
2. If yes to above question, is there a better way to visualize this data?

Update #2: Attaching a new plot on the advice of @pela of reducing the marker size.

But the questions still remain. I will keep updating my progress and once I learn the best way to do the correct visualtization, I will post an answer (unless somebody posts it before me). Thanks in advance!

• It's not clear if you're attempting to make a 3d model, or a celestial sphere, which is 2d. But you have the info for a 3D model using the x, y, z coordinates, and the RA/Dec for plotting on a celestial sphere. You won't need the other data. Jun 10, 2022 at 4:08
• @GregMiller Yes, so I should have worded better there. Not a celestial sphere. Actually my data is only from a part of the sky. I just plotted the data using the x,y,z co-ordinates and because there is like 80k entries, I got a "solid angle" as a the plot. I need to find a way to visualise it better. Jun 10, 2022 at 10:35
• Which units are your {x,y,z} values in? I still don't understand why you would need anything else than that. If you're asking how to convert redshift to distance, or how to convert between various distance measures, then that seems a different question which doesn't really have anything to do with plotting.
– pela
Jun 10, 2022 at 12:49
• @pela The x,y,z are in Mpc/h. And yes, I have less doubt in plotting but I want to understand what I'm plotting and how can I plot it in a better way. I will post an update of plotly plot in a while. Jun 10, 2022 at 13:50
• You could plot only, say, 10% of the galaxies (randomly chosen), and/or decrease point size, and/or make them more transparent. If you use plt.scatter(), try e.g. s=5 (or even s=1) and alpha=0.1.
– pela
Jun 10, 2022 at 21:27