Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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'])"
]
},
{
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -673,7 +670,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "cmi",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like metadata from the env I ran it in (my env is called "cmi").

"language": "python",
"name": "python3"
},
Expand All @@ -687,7 +684,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
"version": "3.13.5"
}
},
"nbformat": 4,
Expand Down
11 changes: 4 additions & 7 deletions docs/examples/ch03NiModelling/exercises/diffpy-cmi/fitNPPt.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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'])"
]
},
{
Expand Down Expand Up @@ -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",
Expand Down
23 changes: 23 additions & 0 deletions news/stylesheets.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* Add BG stylesheets for plotting.

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
3 changes: 1 addition & 2 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__")
Loading