Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DX: remove figure_formats = ["svg"] statement #507

Merged
merged 2 commits into from
Dec 2, 2023
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/ComPWA/repo-maintenance
rev: 0.1.4
rev: 0.1.5
hooks:
- id: check-dev-files
args:
Expand Down
12 changes: 5 additions & 7 deletions docs/amplitude-analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
},
"outputs": [],
"source": [
"%config InlineBackend.figure_formats = ['svg']\n",
"import os\n",
"\n",
"STATIC_WEB_PAGE = {\"EXECUTE_NB\", \"READTHEDOCS\"}.intersection(os.environ)"
Expand Down Expand Up @@ -749,15 +748,15 @@
},
"outputs": [],
"source": [
"%config InlineBackend.figure_formats = ['svg']\n",
"import matplotlib.pyplot as plt\n",
"from matplotlib import cm\n",
"\n",
"resonances = sorted(\n",
" reaction.get_intermediate_particles(),\n",
" key=lambda p: p.mass,\n",
")\n",
"evenly_spaced_interval = np.linspace(0, 1, len(resonances))\n",
"colors = [cm.rainbow(x) for x in evenly_spaced_interval]\n",
"colors = [plt.cm.rainbow(x) for x in evenly_spaced_interval]\n",
"fig, ax = plt.subplots(figsize=(9, 4))\n",
"ax.hist(\n",
" np.real(data_frame[\"m_12\"]),\n",
Expand Down Expand Up @@ -1466,15 +1465,14 @@
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"from matplotlib import cm\n",
"\n",
"resonances = sorted(\n",
" reaction.get_intermediate_particles(),\n",
" key=lambda p: p.mass,\n",
")\n",
"\n",
"evenly_spaced_interval = np.linspace(0, 1, len(resonances))\n",
"colors = [cm.rainbow(x) for x in evenly_spaced_interval]\n",
"colors = [plt.cm.rainbow(x) for x in evenly_spaced_interval]\n",
"\n",
"\n",
"def indicate_masses(ax):\n",
Expand Down Expand Up @@ -1918,7 +1916,7 @@
},
"outputs": [],
"source": [
"fig, ax = plt.subplots(1, figsize=(8, 5))\n",
"fig, ax = plt.subplots(figsize=(8, 5))\n",
"bins = 150\n",
"phsp_projection = np.real(phsp[\"m_12\"])\n",
"ax.hist(\n",
Expand Down Expand Up @@ -1990,7 +1988,7 @@
" sub_dataset = helicity_transformer(sub_events)\n",
" masses.append(np.real(sub_dataset[\"m_12\"]))\n",
"\n",
"fig, ax = plt.subplots(1, figsize=(8, 5))\n",
"fig, ax = plt.subplots(figsize=(8, 5))\n",
"plt.hist(masses, bins=100, stacked=True, alpha=0.6)\n",
"ax.set_xlim(0.25, 2.5)\n",
"ax.set_xlabel(R\"$m_{\\pi^0\\pi^0}$ [GeV]\")\n",
Expand Down
5 changes: 2 additions & 3 deletions docs/amplitude-analysis/analytic-continuation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
},
"outputs": [],
"source": [
"%config InlineBackend.figure_formats = ['svg']\n",
"import os\n",
"\n",
"STATIC_WEB_PAGE = {\"EXECUTE_NB\", \"READTHEDOCS\"}.intersection(os.environ)"
Expand Down Expand Up @@ -257,8 +256,8 @@
},
"outputs": [],
"source": [
"%config InlineBackend.figure_formats = ['svg']\n",
"import numpy as np\n",
"from matplotlib import cm\n",
"\n",
"phsp = helicity_transformer(phsp_momenta)\n",
"intensities = np.array(intensity(phsp))\n",
Expand All @@ -268,7 +267,7 @@
" key=lambda p: p.mass,\n",
")\n",
"evenly_spaced_interval = np.linspace(0, 1, len(resonances))\n",
"colors = [cm.rainbow(x) for x in evenly_spaced_interval]\n",
"colors = [plt.cm.rainbow(x) for x in evenly_spaced_interval]\n",
"\n",
"fig, ax = plt.subplots()\n",
"ax.set_xlabel(\"$m_{02}$ [GeV]\")\n",
Expand Down
14 changes: 8 additions & 6 deletions docs/usage.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
},
"outputs": [],
"source": [
"%config InlineBackend.figure_formats = ['svg']\n",
"import os\n",
"\n",
"STATIC_WEB_PAGE = {\"EXECUTE_NB\", \"READTHEDOCS\"}.intersection(os.environ)"
Expand Down Expand Up @@ -192,6 +191,7 @@
},
"outputs": [],
"source": [
"%config InlineBackend.figure_formats = ['svg']\n",
"import matplotlib.pyplot as plt\n",
"\n",
"fig, ax = plt.subplots(figsize=(5, 3))\n",
Expand Down Expand Up @@ -246,6 +246,7 @@
},
"outputs": [],
"source": [
"%config InlineBackend.figure_formats = ['svg']\n",
"%matplotlib widget\n",
"import matplotlib.pyplot as plt\n",
"from matplotlib.animation import PillowWriter\n",
Expand Down Expand Up @@ -703,19 +704,20 @@
"source_hidden": true
},
"tags": [
"full-width",
"hide-input"
]
},
"outputs": [],
"source": [
"from matplotlib import cm\n",
"%config InlineBackend.figure_formats = ['png']\n",
"\n",
"fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(7, 4.3))\n",
"fig.canvas.toolbar_visible = False\n",
"fig.canvas.header_visible = False\n",
"fig.canvas.footer_visible = False\n",
"ax1.hist2d(*cartesian_data.values(), bins=100, cmap=cm.coolwarm)\n",
"ax2.hist2d(polar_data[\"phi\"], polar_data[\"r\"], bins=100, cmap=cm.coolwarm)\n",
"ax1.hist2d(*cartesian_data.values(), bins=100, cmap=plt.cm.coolwarm)\n",
"ax2.hist2d(polar_data[\"phi\"], polar_data[\"r\"], bins=100, cmap=plt.cm.coolwarm)\n",
"fig.suptitle(\"Hit-and-miss intensity distribution\")\n",
"ax1.set_title(\"cartesian\")\n",
"ax2.set_title(\"polar\")\n",
Expand Down Expand Up @@ -771,11 +773,11 @@
},
"outputs": [],
"source": [
"%config InlineBackend.figure_formats = ['png']\n",
"%matplotlib widget\n",
"import ipywidgets\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"from matplotlib import cm\n",
"\n",
"size = 200\n",
"X, Y = np.meshgrid(\n",
Expand Down Expand Up @@ -810,7 +812,7 @@
" Z = polar_function(polar_domain)\n",
" if color_mesh is not None:\n",
" color_mesh.remove()\n",
" color_mesh = ax_interactive.pcolormesh(X, Y, Z, cmap=cm.coolwarm)"
" color_mesh = ax_interactive.pcolormesh(X, Y, Z, cmap=plt.cm.coolwarm)"
]
},
{
Expand Down
Loading
Loading