diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eb9a52fa..ef8a2ec2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,14 +36,14 @@ jobs: # See https://stackoverflow.com/questions/58121461/runtimeerror-failed-to-process-string-with-tex-because-latex-could-not-be-found # and https://github.com/garrettj403/SciencePlots/issues/53 sudo apt update - sudo apt-get install texlive-latex-extra texlive-fonts-recommended cm-super + # sudo apt-get install texlive-latex-extra texlive-fonts-recommended cm-super elif [ "$RUNNER_OS" == "macOS" ]; then # Install macports for the latex stuff. See https://github.com/GiovanniBussi/macports-ci curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci source ./macports-ci install - sudo port install texlive-latex-extra texlive-fonts-recommended + # sudo port install texlive-latex-extra texlive-fonts-recommended fi pip install pytest nbconvert ipykernel latex diff --git a/examples/gw_eccentricity_demo.ipynb b/examples/gw_eccentricity_demo.ipynb index 95bbbde7..50475a29 100644 --- a/examples/gw_eccentricity_demo.ipynb +++ b/examples/gw_eccentricity_demo.ipynb @@ -28,7 +28,7 @@ "from gw_eccentricity import measure_eccentricity\n", "from gw_eccentricity import get_available_methods\n", "from gw_eccentricity.plot_settings import use_fancy_plotsettings, labelsDict\n", - "use_fancy_plotsettings() # for better looking plots" + "use_fancy_plotsettings(usetex=False)" ] }, { @@ -884,7 +884,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.0" + "version": "3.10.9" } }, "nbformat": 4, diff --git a/examples/load_waveform_demo.ipynb b/examples/load_waveform_demo.ipynb index 8c6b2757..ae039627 100644 --- a/examples/load_waveform_demo.ipynb +++ b/examples/load_waveform_demo.ipynb @@ -214,7 +214,7 @@ "}\n", "origin = \"LAL\"\n", "dataDict = load_waveform(origin, **kwargs)\n", - "use_fancy_plotsettings() # use better defaults for plotting\n", + "use_fancy_plotsettings(usetex=False)\n", "fig, ax = plt.subplots(figsize=(12, 4))\n", "# Plot the amplitude of the (2,2) mode\n", "ax.plot(dataDict[\"t\"], np.abs(dataDict[\"hlm\"][(2, 2)]), label=kwargs[\"approximant\"])\n", @@ -371,7 +371,7 @@ "dataDict = load_waveform(origin, **kwargs)\n", "\n", "# use better defaults for plotting\n", - "use_fancy_plotsettings()\n", + "use_fancy_plotsettings(usetex=False)\n", "fig, ax = plt.subplots(figsize=(12, 4))\n", "# plot amplitude of the (2, 2) mode of eccentric waveform\n", "ax.plot(dataDict[\"t\"], np.abs(dataDict[\"hlm\"][(2, 2)]), label=origin)\n", @@ -499,7 +499,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.0" + "version": "3.10.9" }, "vscode": { "interpreter": { diff --git a/gw_eccentricity/eccDefinition.py b/gw_eccentricity/eccDefinition.py index 8d2bd195..92d86a54 100644 --- a/gw_eccentricity/eccDefinition.py +++ b/gw_eccentricity/eccDefinition.py @@ -1922,7 +1922,7 @@ def get_fref_out(self, fref_in, method): def make_diagnostic_plots( self, add_help_text=True, - usetex=True, + usetex=False, style=None, use_fancy_settings=True, twocol=False, @@ -1977,7 +1977,7 @@ def make_diagnostic_plots( Default is True. usetex: If True, use TeX to render texts. - Default is True. + Default is False. style: Set font size, figure size suitable for particular use case. For example, to generate plot for "APS" journals, use style="APS". For @@ -2062,7 +2062,7 @@ def plot_eccentricity( fig=None, ax=None, add_help_text=True, - usetex=True, + usetex=False, style="Notebook", use_fancy_settings=True, add_vline_at_tref=True, @@ -2082,7 +2082,7 @@ def plot_eccentricity( Default is True. usetex: If True, use TeX to render texts. - Default is True. + Default is False. style: Set font size, figure size suitable for particular use case. For example, to generate plot for "APS" journals, use style="APS". For @@ -2134,7 +2134,7 @@ def plot_decc_dt( fig=None, ax=None, add_help_text=True, - usetex=True, + usetex=False, style="Notebook", use_fancy_settings=True, **kwargs): @@ -2155,7 +2155,7 @@ def plot_decc_dt( Default is True. usetex: If True, use TeX to render texts. - Default is True. + Default is False. style: Set font size, figure size suitable for particular use case. For example, to generate plot for "APS" journals, use style="APS". For @@ -2207,7 +2207,7 @@ def plot_mean_anomaly( fig=None, ax=None, add_help_text=True, - usetex=True, + usetex=False, style="Notebook", use_fancy_settings=True, add_vline_at_tref=True, @@ -2227,7 +2227,7 @@ def plot_mean_anomaly( Default is True. usetex: If True, use TeX to render texts. - Default is True. + Default is False. style: Set font size, figure size suitable for particular use case. For example, to generate plot for "APS" journals, use style="APS". For @@ -2279,7 +2279,7 @@ def plot_omega22( fig=None, ax=None, add_help_text=True, - usetex=True, + usetex=False, style="Notebook", use_fancy_settings=True, **kwargs): @@ -2302,7 +2302,7 @@ def plot_omega22( Default is True. usetex: If True, use TeX to render texts. - Default is True. + Default is False. style: Set font size, figure size suitable for particular use case. For example, to generate plot for "APS" journals, use style="APS". For @@ -2350,12 +2350,20 @@ def plot_omega22( ax.set_ylim(ymin - pad, ymax + pad) # add help text if add_help_text: + if usetex: + help_text = ( + r"\noindent To avoid extrapolation, first and last\\" + r"extrema are excluded when\\" + r"evaluating $\omega_{a}$/$\omega_{p}$ interpolants") + else: + help_text = ( + "To avoid extrapolation, first and last\n" + "extrema are excluded when\n" + r"evaluating $\omega_{a}$/$\omega_{p}$ interpolants") ax.text( 0.22, 0.98, - (r"\noindent To avoid extrapolation, first and last\\" - r"extrema are excluded when\\" - r"evaluating $\omega_{a}$/$\omega_{p}$ interpolants"), + help_text, ha="left", va="top", transform=ax.transAxes) @@ -2373,7 +2381,7 @@ def plot_omega22_average( fig=None, ax=None, add_help_text=True, - usetex=True, + usetex=False, style="Notebook", use_fancy_settings=True, plot_omega22=True, @@ -2394,7 +2402,7 @@ def plot_omega22_average( Default is True. usetex: If True, use TeX to render texts. - Default is True. + Default is False. style: Set font size, figure size suitable for particular use case. For example, to generate plot for "APS" journals, use style="APS". For @@ -2459,7 +2467,7 @@ def plot_omega22_average( ax.text( 0.35, 0.98, - (r"\noindent omega22_average should be " + (r"omega22_average should be " "monotonically increasing."), ha="left", va="top", @@ -2476,7 +2484,7 @@ def plot_amp22( fig=None, ax=None, add_help_text=True, - usetex=True, + usetex=False, style="Notebook", use_fancy_settings=True, **kwargs): @@ -2498,7 +2506,7 @@ def plot_amp22( Default is True. usetex: If True, use TeX to render texts. - Default is True. + Default is False. style: Set font size, figure size suitable for particular use case. For example, to generate plot for "APS" journals, use style="APS". For @@ -2546,7 +2554,7 @@ def plot_phase_diff_ratio_between_extrema( fig=None, ax=None, add_help_text=True, - usetex=True, + usetex=False, style="Notebook", use_fancy_settings=True, **kwargs): @@ -2571,7 +2579,7 @@ def plot_phase_diff_ratio_between_extrema( Default is True. usetex: If True, use TeX to render texts. - Default is True. + Default is False. style: Set font size, figure size suitable for particular use case. For example, to generate plot for "APS" journals, use style="APS". For @@ -2637,7 +2645,7 @@ def plot_residual_omega22( fig=None, ax=None, add_help_text=True, - usetex=True, + usetex=False, style="Notebook", use_fancy_settings=True, **kwargs): @@ -2660,7 +2668,7 @@ def plot_residual_omega22( Default is True. usetex: If True, use TeX to render texts. - Default is True. + Default is False. style: Set font size, figure size suitable for particular use case. For example, to generate plot for "APS" journals, use style="APS". For @@ -2710,7 +2718,7 @@ def plot_residual_amp22( fig=None, ax=None, add_help_text=True, - usetex=True, + usetex=False, style="Notebook", use_fancy_settings=True, **kwargs): @@ -2729,7 +2737,7 @@ def plot_residual_amp22( Default is True. usetex: If True, use TeX to render texts. - Default is True. + Default is False. style: Set font size, figure size suitable for particular use case. For example, to generate plot for "APS" journals, use style="APS". For @@ -2781,7 +2789,7 @@ def plot_data_used_for_finding_extrema( fig=None, ax=None, add_help_text=True, - usetex=True, + usetex=False, style="Notebook", use_fancy_settings=True, add_vline_at_tref=True, @@ -2802,7 +2810,7 @@ def plot_data_used_for_finding_extrema( Default is True. usetex: If True, use TeX to render texts. - Default is True. + Default is False. style: Set font size, figure size suitable for particular use case. For example, to generate plot for "APS" journals, use style="APS". For diff --git a/gw_eccentricity/plot_settings.py b/gw_eccentricity/plot_settings.py index 6cb78abb..30868714 100644 --- a/gw_eccentricity/plot_settings.py +++ b/gw_eccentricity/plot_settings.py @@ -125,8 +125,9 @@ def use_fancy_plotsettings(usetex=True, style="Notebook"): rc("legend", frameon=False) rc("legend", fontsize=fontSizeDict[style]) # Fonts - rc("font", family="serif") - rc("font", serif="times") + if usetex: + rc("font", family="serif") + rc("font", serif="times") rc("font", size=fontSizeDict[style]) # Lines rc("lines", linewidth=1.0)