diff --git a/docs/examples/ch03NiModelling/exercises/diffpy-cmi/fitBulkNi.ipynb b/docs/examples/ch03NiModelling/exercises/diffpy-cmi/fitBulkNi.ipynb index ed829ec..ccee65e 100644 --- a/docs/examples/ch03NiModelling/exercises/diffpy-cmi/fitBulkNi.ipynb +++ b/docs/examples/ch03NiModelling/exercises/diffpy-cmi/fitBulkNi.ipynb @@ -33,7 +33,10 @@ "import matplotlib as mpl\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "from scipy.optimize import least_squares" + "from scipy.optimize import least_squares\n", + "from bg_mpl_stylesheets.styles import all_styles\n", + "\n", + "plt.style.use(all_styles['bg-style'])" ] }, { @@ -470,12 +473,6 @@ " # Calculate the residual (difference) array and offset it vertically.\n", " diff = g - gcalc + diffzero\n", "\n", - " # Change some style details of the plot\n", - " mpl.rcParams.update(mpl.rcParamsDefault)\n", - " if (PWD.parent.parent.parent / \"utils\" / \"billinge.mplstyle\").exists():\n", - " plt.style.use(str(PWD.parent.parent.parent /\n", - " \"utils\" / \"billinge.mplstyle\"))\n", - "\n", " # Create a figure and an axis on which to plot\n", " fig, ax1 = plt.subplots(1, 1)\n", "\n", @@ -673,7 +670,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "cmi", "language": "python", "name": "python3" }, @@ -687,7 +684,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.4" + "version": "3.13.5" } }, "nbformat": 4, diff --git a/docs/examples/ch03NiModelling/exercises/diffpy-cmi/fitNPPt.ipynb b/docs/examples/ch03NiModelling/exercises/diffpy-cmi/fitNPPt.ipynb index 1ecfd02..88ee1b5 100644 --- a/docs/examples/ch03NiModelling/exercises/diffpy-cmi/fitNPPt.ipynb +++ b/docs/examples/ch03NiModelling/exercises/diffpy-cmi/fitNPPt.ipynb @@ -27,7 +27,10 @@ "import matplotlib as mpl\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "from scipy.optimize import least_squares" + "from scipy.optimize import least_squares\n", + "from bg_mpl_stylesheets.styles import all_styles\n", + "\n", + "plt.style.use(all_styles['bg-style'])" ] }, { @@ -386,12 +389,6 @@ " # Calculate the residual (difference) array and offset it vertically.\n", " diff = g - gcalc + diffzero\n", "\n", - " # Change some style details of the plot\n", - " mpl.rcParams.update(mpl.rcParamsDefault)\n", - " if (PWD.parent.parent.parent / \"utils\" / \"billinge.mplstyle\").exists():\n", - " plt.style.use(str(PWD.parent.parent.parent /\n", - " \"utils\" / \"billinge.mplstyle\"))\n", - "\n", " # Create a figure and an axis on which to plot\n", " fig, ax1 = plt.subplots(1, 1)\n", "\n", diff --git a/news/stylesheets.rst b/news/stylesheets.rst new file mode 100644 index 0000000..6cb17dc --- /dev/null +++ b/news/stylesheets.rst @@ -0,0 +1,23 @@ +**Added:** + +* Add BG stylesheets for plotting. + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/tests/test_examples.py b/tests/test_examples.py index 96cd573..fafbfab 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -7,7 +7,6 @@ def test_all_examples(tmp_examples): # sort list so that fitBulkNi.py runs first scripts.sort(key=lambda s: 0 if s.name == "fitBulkNi.py" else 1) for script in scripts: - script_relative_path = script.relative_to(tmp_examples).as_posix() - print("hello", script_relative_path) + script_relative_path = script.relative_to(tmp_examples) print(f"Testing {script_relative_path}") runpy.run_path(str(script), run_name="__main__")