|
58 | 58 | "metadata": {}, |
59 | 59 | "outputs": [], |
60 | 60 | "source": [ |
61 | | - "from astropy.cosmology import FlatLambdaCDM\n", |
62 | 61 | "import astropy.units as u\n", |
| 62 | + "from astropy.cosmology import FlatLambdaCDM\n", |
63 | 63 | "\n", |
64 | 64 | "# In this case we just need to define the matter density\n", |
65 | 65 | "# and hubble parameter at z=0.\n", |
|
197 | 197 | "ax.plot(zvals, dist)\n", |
198 | 198 | "ax2 = ax.twiny()\n", |
199 | 199 | "ax2.set_xticks(ageticks)\n", |
200 | | - "ax2.set_xticklabels([\"{:g}\".format(age) for age in ages.value])" |
| 200 | + "ax2.set_xticklabels([f\"{age:g}\" for age in ages.value])" |
201 | 201 | ] |
202 | 202 | }, |
203 | 203 | { |
|
218 | 218 | "ax.plot(zvals, dist)\n", |
219 | 219 | "ax2 = ax.twiny()\n", |
220 | 220 | "ax2.set_xticks(ageticks)\n", |
221 | | - "ax2.set_xticklabels([\"{:g}\".format(age) for age in ages.value])\n", |
| 221 | + "ax2.set_xticklabels([f\"{age:g}\" for age in ages.value])\n", |
222 | 222 | "zmin, zmax = 0.0, 5.9\n", |
223 | 223 | "ax.set_xlim(zmin, zmax)\n", |
224 | 224 | "ax2.set_xlim(zmin, zmax)" |
|
242 | 242 | "ax.plot(zvals, dist)\n", |
243 | 243 | "ax2 = ax.twiny()\n", |
244 | 244 | "ax2.set_xticks(ageticks)\n", |
245 | | - "ax2.set_xticklabels([\"{:g}\".format(age) for age in ages.value])\n", |
| 245 | + "ax2.set_xticklabels([f\"{age:g}\" for age in ages.value])\n", |
246 | 246 | "zmin, zmax = 0, 5.9\n", |
247 | 247 | "ax.set_xlim(zmin, zmax)\n", |
248 | 248 | "ax2.set_xlim(zmin, zmax)\n", |
|
273 | 273 | "fig = plt.figure(figsize=(6, 4))\n", |
274 | 274 | "ax = fig.add_subplot(111)\n", |
275 | 275 | "ax.plot(zvals, dist2, label=\"Planck 2013\")\n", |
276 | | - "ax.plot(zvals, dist, label=\"$h=0.7,\\ \\Omega_M=0.3,\\ \\Omega_\\Lambda=0.7$\")\n", |
| 276 | + "ax.plot(zvals, dist, label=r\"$h=0.7,\\ \\Omega_M=0.3,\\ \\Omega_\\Lambda=0.7$\")\n", |
277 | 277 | "ax.legend(frameon=0, loc=\"lower right\")\n", |
278 | 278 | "ax2 = ax.twiny()\n", |
279 | 279 | "ax2.set_xticks(ageticks)\n", |
280 | | - "ax2.set_xticklabels([\"{:g}\".format(age) for age in ages.value])\n", |
| 280 | + "ax2.set_xticklabels([f\"{age:g}\" for age in ages.value])\n", |
281 | 281 | "zmin, zmax = 0.0, 5.9\n", |
282 | 282 | "ax.set_xlim(zmin, zmax)\n", |
283 | 283 | "ax2.set_xlim(zmin, zmax)\n", |
|
0 commit comments