Skip to content

Commit bb69765

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 5bb61ba commit bb69765

9 files changed

Lines changed: 87 additions & 26 deletions

File tree

‎docs/examples/devlop/devlop-imshow.ipynb‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"metadata": {},
2222
"outputs": [],
2323
"source": [
24-
"\n",
2524
"parameter1 = np.linspace(-5, 5)\n",
2625
"parameter2 = np.linspace(-5, 5, 25)\n",
2726
"x = np.linspace(0, np.pi, 200)\n",

‎docs/examples/devlop/devlop-scatter.ipynb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@
255255
" return x, y\n",
256256
"\n",
257257
"\n",
258-
"(x, y) = f(0.5)\n",
258+
"x, y = f(0.5)\n",
259259
"\n",
260260
"\n",
261261
"def threshold(x, y, mean):\n",

‎docs/examples/errorbar.ipynb‎

Lines changed: 66 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@
5454
},
5555
{
5656
"cell_type": "markdown",
57-
"source": "![](../_static/images/errorbar-sine.gif)",
58-
"metadata": {}
57+
"metadata": {},
58+
"source": [
59+
"![](../_static/images/errorbar-sine.gif)"
60+
]
5961
},
6062
{
6163
"cell_type": "markdown",
@@ -71,29 +73,82 @@
7173
"execution_count": null,
7274
"metadata": {},
7375
"outputs": [],
74-
"source": "def x_func(tau):\n return np.linspace(0, 2 * np.pi * tau, 50)\n\n\ndef y_func(x, tau):\n return np.sin(x)\n\n\ndef yerr_func(tau):\n return np.full(50, 0.1 * tau)\n\n\ndef xerr_func(tau):\n return np.full(50, 0.05 * tau)\n\n\nfig, ax = plt.subplots()\ncontrols = iplt.errorbar(\n x_func, y_func, yerr=yerr_func, xerr=xerr_func, tau=(1, 5, 100), xlim=\"auto\"\n)"
76+
"source": [
77+
"def x_func(tau):\n",
78+
" return np.linspace(0, 2 * np.pi * tau, 50)\n",
79+
"\n",
80+
"\n",
81+
"def y_func(x, tau):\n",
82+
" return np.sin(x)\n",
83+
"\n",
84+
"\n",
85+
"def yerr_func(tau):\n",
86+
" return np.full(50, 0.1 * tau)\n",
87+
"\n",
88+
"\n",
89+
"def xerr_func(tau):\n",
90+
" return np.full(50, 0.05 * tau)\n",
91+
"\n",
92+
"\n",
93+
"fig, ax = plt.subplots()\n",
94+
"controls = iplt.errorbar(\n",
95+
" x_func, y_func, yerr=yerr_func, xerr=xerr_func, tau=(1, 5, 100), xlim=\"auto\"\n",
96+
")"
97+
]
7598
},
7699
{
77100
"cell_type": "markdown",
78-
"source": "![](../_static/images/errorbar-all-functions.gif)",
79-
"metadata": {}
101+
"metadata": {},
102+
"source": [
103+
"![](../_static/images/errorbar-all-functions.gif)"
104+
]
80105
},
81106
{
82107
"cell_type": "markdown",
83-
"source": "## Styling\n\nErrorbar-specific kwargs (`capsize`, `ecolor`, `elinewidth`, etc.) and Line2D kwargs (`color`, `linewidth`, `markersize`, etc.) are passed through to `ax.errorbar`.",
84-
"metadata": {}
108+
"metadata": {},
109+
"source": [
110+
"## Styling\n",
111+
"\n",
112+
"Errorbar-specific kwargs (`capsize`, `ecolor`, `elinewidth`, etc.) and Line2D kwargs (`color`, `linewidth`, `markersize`, etc.) are passed through to `ax.errorbar`."
113+
]
85114
},
86115
{
87116
"cell_type": "code",
88117
"execution_count": null,
89118
"metadata": {},
90119
"outputs": [],
91-
"source": "x = np.linspace(0, 2 * np.pi, 30)\n\n\ndef y_func(x, tau):\n return np.cos(x * tau)\n\n\ndef yerr_func(tau):\n return np.full(30, 0.1 * tau)\n\n\nfig, ax = plt.subplots()\ncontrols = iplt.errorbar(\n x,\n y_func,\n yerr=yerr_func,\n tau=(1, 10, 100),\n fmt=\"o\",\n markersize=8,\n capsize=4,\n ecolor=\"gray\",\n color=\"C0\",\n)"
120+
"source": [
121+
"x = np.linspace(0, 2 * np.pi, 30)\n",
122+
"\n",
123+
"\n",
124+
"def y_func(x, tau):\n",
125+
" return np.cos(x * tau)\n",
126+
"\n",
127+
"\n",
128+
"def yerr_func(tau):\n",
129+
" return np.full(30, 0.1 * tau)\n",
130+
"\n",
131+
"\n",
132+
"fig, ax = plt.subplots()\n",
133+
"controls = iplt.errorbar(\n",
134+
" x,\n",
135+
" y_func,\n",
136+
" yerr=yerr_func,\n",
137+
" tau=(1, 10, 100),\n",
138+
" fmt=\"o\",\n",
139+
" markersize=8,\n",
140+
" capsize=4,\n",
141+
" ecolor=\"gray\",\n",
142+
" color=\"C0\",\n",
143+
")"
144+
]
92145
},
93146
{
94147
"cell_type": "markdown",
95-
"source": "![](../_static/images/errorbar-styling.gif)",
96-
"metadata": {}
148+
"metadata": {},
149+
"source": [
150+
"![](../_static/images/errorbar-styling.gif)"
151+
]
97152
}
98153
],
99154
"metadata": {
@@ -109,4 +164,4 @@
109164
},
110165
"nbformat": 4,
111166
"nbformat_minor": 4
112-
}
167+
}

‎docs/examples/scalar-arguments.ipynb‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@
9696
"metadata": {},
9797
"outputs": [],
9898
"source": [
99-
"\n",
10099
"# create the controls object\n",
101100
"ctrls = Controls(size=(10, 1000))\n",
102101
"\n",

‎mpl_interactions/generic.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
notebook_backend,
1515
)
1616
from .mpl_kwargs import imshow_kwargs_list, kwarg_popper
17-
from .utils import figure, nearest_idx
17+
from .utils import nearest_idx
1818
from .xarray_helpers import get_hs_axes, get_hs_extent, get_hs_fmts
1919

2020
# functions that are methods

‎mpl_interactions/ipyplot.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from .pyplot import interactive_axhline as axhline
22
from .pyplot import interactive_axvline as axvline
3+
from .pyplot import interactive_errorbar as errorbar
34
from .pyplot import interactive_hist as hist
45
from .pyplot import interactive_imshow as imshow
56
from .pyplot import interactive_plot as plot
@@ -8,4 +9,3 @@
89
from .pyplot import interactive_title as title
910
from .pyplot import interactive_xlabel as xlabel
1011
from .pyplot import interactive_ylabel as ylabel
11-
from .pyplot import interactive_errorbar as errorbar

‎mpl_interactions/pyplot.py‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
Line2D_kwargs_list,
3131
Text_kwargs_list,
3232
collection_kwargs_list,
33-
imshow_kwargs_list,
3433
errorbar_kwargs_list,
34+
imshow_kwargs_list,
3535
kwarg_popper,
3636
)
3737

@@ -368,9 +368,7 @@ def yerr_func(tau):
368368
interactive_errorbar(x, y_func, yerr=yerr_func, tau=tau)
369369
370370
"""
371-
kwargs, errorbar_kwargs = kwarg_popper(
372-
kwargs, Line2D_kwargs_list + errorbar_kwargs_list
373-
)
371+
kwargs, errorbar_kwargs = kwarg_popper(kwargs, Line2D_kwargs_list + errorbar_kwargs_list)
374372

375373
funcs, extra_ctrls, param_excluder = prep_scalars(kwargs)
376374

@@ -396,8 +394,12 @@ def update(params, indices, cache):
396394
nonlocal container
397395

398396
x_, y_ = eval_xy(x, y, param_excluder(params), cache)
399-
yerr_ = callable_else_value(yerr, param_excluder(params), cache) if yerr is not None else None
400-
xerr_ = callable_else_value(xerr, param_excluder(params), cache) if xerr is not None else None
397+
yerr_ = (
398+
callable_else_value(yerr, param_excluder(params), cache) if yerr is not None else None
399+
)
400+
xerr_ = (
401+
callable_else_value(xerr, param_excluder(params), cache) if xerr is not None else None
402+
)
401403

402404
eb_kwargs = dict(errorbar_kwargs)
403405
container.remove()

‎tests/test_generic.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def test_heatmap_slicer():
2424
)
2525

2626

27-
2827
def test_xr_hyperslicer_extents():
2928
arr = np.zeros([10, 150, 200])
3029
arr[:, 50:100, 50:150] = 1

‎tests/test_pyplot.py‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,22 @@ def xerr_fn(tau):
122122
test_ax = fig_test.add_subplot()
123123
ylims = (-15, 15)
124124
controls = interactive_errorbar(
125-
x_fn, y_fn, yerr=yerr_fn, xerr=xerr_fn,
126-
tau=tau, ax=test_ax, ylim=ylims, capsize=3,
125+
x_fn,
126+
y_fn,
127+
yerr=yerr_fn,
128+
xerr=xerr_fn,
129+
tau=tau,
130+
ax=test_ax,
131+
ylim=ylims,
132+
capsize=3,
127133
)
128134
set_param_values(controls, {"tau": 7})
129135

130136
ref_ax = fig_ref.add_subplot()
131137
x_ = x_fn(**controls.params)
132138
ref_ax.errorbar(
133-
x_, y_fn(x_, **controls.params),
139+
x_,
140+
y_fn(x_, **controls.params),
134141
yerr=yerr_fn(**controls.params),
135142
xerr=xerr_fn(**controls.params),
136143
capsize=3,

0 commit comments

Comments
 (0)