Skip to content

Commit 17b692e

Browse files
committed
colab fix
1 parent 8a35c86 commit 17b692e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

notebooks/20_flux_ratio.ipynb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,24 @@
2626
"metadata": {},
2727
"outputs": [],
2828
"source": [
29-
"import numpy as np, matplotlib.pyplot as plt\n",
29+
"import numpy as np\n",
30+
"import matplotlib.pyplot as plt\n",
3031
"from palatini_pt.equivalence.flux_ratio import flux_ratio_FRW\n",
3132
"\n",
33+
"# (可選)為了 Colab 更保險,明確指定使用 mathtext 而不是外部 TeX\n",
34+
"import matplotlib as mpl\n",
35+
"mpl.rcParams[\"text.usetex\"] = False\n",
36+
"mpl.rcParams[\"mathtext.fontset\"] = \"stix\" # or 'dejavusans'\n",
37+
"mpl.rcParams[\"font.family\"] = \"STIXGeneral\" # 視字型可用性而定\n",
38+
"\n",
3239
"R = np.linspace(5.0, 80.0, 60)\n",
3340
"out = flux_ratio_FRW(R, {\"flux\": {\"sigma\": 1.0, \"c\": 0.5}})\n",
3441
"plt.plot(out[\"R\"], out[\"R_DBI_CM\"])\n",
3542
"plt.axhline(1.0, ls=\"--\")\n",
36-
"plt.xlabel(\"R\"); plt.ylabel(r\"$\\mathcal R_{X/Y}$\")\n",
37-
"plt.title(\"Flux ratio → 1 with $R^{-\\sigma}$ tail\")\n",
43+
"plt.xlabel(\"R\")\n",
44+
"plt.ylabel(r\"$\\mathcal{R}_{X/Y}$\") # <— 加上大括號\n",
45+
"plt.title(r\"Flux ratio → 1 with $R^{-\\sigma}$ tail\") # <— 用 raw string\n",
46+
"plt.tight_layout()\n",
3847
"plt.show()"
3948
]
4049
}

0 commit comments

Comments
 (0)