<p>Suppose I have a catalogue of galaxies in a <code>.dat</code> 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 <span class="math-container">$x$</span>, <span class="math-container">$y$</span> and <span class="math-container">$z$</span> co-ordinates of the galaxy.</p>
<p>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 <span class="math-container">$x$</span>, <span class="math-container">$y$</span> and <span class="math-container">$z$</span> co-ordinates? The direct coordinate transformation from equatorial co-ordinates to ra and dec using comoving distance as <span class="math-container">$r$</span> 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 <span class="math-container">$x$</span>, <span class="math-container">$y$</span> and <span class="math-container">$z$</span> co-ordinates)?</p>
<p>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.</p>
<p><strong>Update #1:</strong>
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).</p>
<p><a href="https://i.sstatic.net/bxvx1.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/bxvx1.png" alt="enter image description here" /></a></p>
<p>So I now have two questions:</p>
<ol>
<li>Each of the point (~80k) represents a galaxy. Is it correct to use the <span class="math-container">$x$</span>, <span class="math-container">$y$</span> and <span class="math-container">$z$</span> co-ordinates here (whose units are in Mpc/h)?</li>
<li>If yes to above question, is there a better way to visualize this data?</li>
</ol>
<p><strong>Update #2:</strong>
Attaching a new plot on the advice of @pela of reducing the marker size.
<a href="https://i.sstatic.net/AyZcA.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/AyZcA.png" alt="enter image description here" /></a></p>
<p>But the questions still remain. I will keep updating my progress and once I learn the best way to do the <em>correct</em> visualtization, I will post an answer (unless somebody posts it before me).
Thanks in advance!</p>

CC BY-SA 4.0
2022-06-10T04:08:49.530Z
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.
Greg Miller
CC BY-SA 4.0
2022-06-10T10:35:42.340Z
@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.
peakcipher
CC BY-SA 4.0
2022-06-10T12:49:50.850Z
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
CC BY-SA 4.0
2022-06-10T13:50:19.830Z
@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.
peakcipher
CC BY-SA 4.0
2022-06-10T21:27:56.907Z
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
CC BY-SA 4.0
2022-06-10T21:29:26.583Z
Plotting less than 80e3 galaxies will also make it less heavy if you’re manually rotating the plot.
pela
CC BY-SA 4.0
2022-06-11T23:01:09.813Z
@pela About the point of randomly selecting galaxies, I don't know. I am actually not even sure why my instructor asked me to do this. If you are interested, they are void galaxies catalogued [here](http://www.physics.drexel.edu/~pan/VoidCatalog/).
peakcipher
<cosmology><coordinate><redshift>
Plotting galaxies in 3-D
peakcipher
# Plotting galaxies in 3-D

(Asked by: username_0 on 2022-06-09)

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).

[![enter image description here](https://i.sstatic.net/bxvx1.png)](https://i.sstatic.net/bxvx1.png)

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 @username_2 of reducing the marker size.
[![enter image description here](https://i.sstatic.net/AyZcA.png)](https://i.sstatic.net/AyZcA.png)

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!

**Tags:** cosmology, coordinate, redshift

> **Comments:**
> **username_1**: 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.  
> **username_0**: @username_1 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.  
> **username_2**: 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.  
> **username_0**: @username_2 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.  
> **username_2**: 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.  
> **username_2**: Plotting less than 80e3 galaxies will also make it less heavy if you’re manually rotating the plot.  
> **username_0**: @username_2 About the point of randomly selecting galaxies, I don't know. I am actually not even sure why my instructor asked me to do this. If you are interested, they are void galaxies catalogued [here](http://www.physics.drexel.edu/~pan/VoidCatalog/).  

---

## 0 answers

