Comoving_distance_and_lookback_time_(Planck_2018).png


Summary

Description
English: This plot shows the comoving distance and lookback time for the Planck 2018 cosmology parameters, from redshift 0 to 15, with distance (blue solid line) on the left axis, and time (orange dashed line) on the right. Note that the time that has passed (in giga years) from a given redshift until now is not the same as the distance (in giga light years) to that redshift, due to the expansion of space over the intervening period.
Date
Source Own work
Author Parejkoj

This plot was generated with the following python code, using astropy, numpy, and matplotlib:

import matplotlib.pyplot as plt
import numpy as np
import astropy.units as u
from astropy.cosmology import Planck18

z = np.arange(0, 15, 0.01)

fig, ax1 = plt.subplots()
ax2 = ax1.twinx()

fontkwargs = {"fontweight": "bold", "fontsize": "large"}
color1 = "blue"
lines1 = ax1.plot(z, Planck18.comoving_distance(z).to(u.Glyr),
                  label="distance (left axis)", color=color1)
ax1.set_xlim(0, 15)
ax1.set_xlabel("redshift (z)", fontweight="bold")
ax1.set_xticklabels(ax1.get_xticks(), weight="bold")
ax1.set_ylabel("comoving distance (giga light years)", color=color1, **fontkwargs)
ax1.tick_params(axis='y', colors=color1)
ax1.set_yticklabels(ax1.get_yticks(), weight="bold")

color2 = "darkorange"
# put them on the same vertical scale:
ax2.set_ylim(ax1.get_ylim())
lines2 = ax2.plot(z, Planck18.lookback_time(z), "--",
                  label="time (right axis)", color=color2)
ax2.set_ylabel("lookback time (giga years)", color=color2, **fontkwargs)
ax2.tick_params(axis='y', colors=color2)
ax2.set_yticklabels(ax2.get_yticks(), weight="bold")

ax1.grid()

lines = lines1 + lines2
ax1.legend(lines, [line.get_label() for line in lines], fontsize="large")

plt.savefig("comoving_distance_and_time.png", dpi=300, bbox_inches="tight")
plt.show()
input()

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication .
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Captions

Plot of comoving distance and lookback time for the Planck 2018 cosmology

Items portrayed in this file

depicts

16 November 2023

image/png

64e3b3ff192418f6400bd003865f00f1dbf324b1

144,239 byte

1,294 pixel

1,941 pixel