Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 018f0fa

Browse files
eytanadlerQuLogic
andauthored
Apply suggestions from code review
Co-authored-by: Elliott Sales de Andrade <[email protected]>
1 parent 837a8b7 commit 018f0fa

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

doc/users/next_whats_new/streamplot_integration_control.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ Streamplot integration control
33

44
Two new options have been added to the `~.axes.Axes.streamplot` function that
55
give the user better control of the streamline integration. The first is called
6-
``integration_max_step`` and multiplies the default max step computed by the
7-
integrator. The second is called ``integration_max_error`` and multiplies the
6+
``integration_max_step_scale`` and multiplies the default max step computed by the
7+
integrator. The second is called ``integration_max_error_scale`` and multiplies the
88
default max error set by the integrator. Values for these parameters between
99
zero and one reduce (tighten) the max step or error to improve streamline
1010
accuracy by performing more computation. Values greater than one increase
1111
(loosen) the max step or error to reduce computation time at the cost of lower
1212
streamline accuracy.
1313

1414
The integrator defaults are both hand-tuned values and may not be applicable to
15-
all cases, so this allows the user to customize the behavior to specific use cases.
16-
Modifying only ``integration_max_step`` has proved effective, but it may be useful
15+
all cases, so this allows customizing the behavior to specific use cases.
16+
Modifying only ``integration_max_step_scale`` has proved effective, but it may be useful
1717
to control the error as well.

galleries/examples/images_contours_and_fields/plot_streamplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
# ----------------------
8585
#
8686
# The streamlines are computed by integrating along the provided vector field
87-
# from the seed points, which are either generated automatically or manually
87+
# from the seed points, which are either automatically generated or manually
8888
# specified. The accuracy and smoothness of the streamlines can be adjusted using
8989
# the ``integration_max_step_scale`` and ``integration_max_error_scale`` optional
9090
# parameters. See the `~.axes.Axes.streamplot` function documentation for more

lib/matplotlib/streamplot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
121121
if integration_max_step_scale <= 0.0:
122122
raise ValueError(
123123
"The value of integration_max_step_scale must be > 0, " +
124-
f"got {integration_max_step_scale=}"
124+
f"got {integration_max_step_scale}"
125125
)
126126

127127
if integration_max_error_scale <= 0.0:
128128
raise ValueError(
129129
"The value of integration_max_error_scale must be > 0, " +
130-
f"got {integration_max_error_scale=}"
130+
f"got {integration_max_error_scale}"
131131
)
132132

133133
if num_arrows < 0:

lib/matplotlib/tests/test_streamplot.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,11 @@ def test_streamplot_integration_params():
214214
u = np.ones((2, 2))
215215
v = np.zeros((2, 2))
216216

217-
err_str = "The value of integration_max_step_scale must be > 0, " \
218-
"got integration_max_step_scale=-0.5"
217+
err_str = "The value of integration_max_step_scale must be > 0, got -0.5"
219218
with pytest.raises(ValueError, match=err_str):
220219
plt.streamplot(x, y, u, v, integration_max_step_scale=-0.5)
221220

222-
err_str = "The value of integration_max_error_scale must be > 0, " \
223-
"got integration_max_error_scale=0.0"
221+
err_str = "The value of integration_max_error_scale must be > 0, got 0.0"
224222
with pytest.raises(ValueError, match=err_str):
225223
plt.streamplot(x, y, u, v, integration_max_error_scale=0.0)
226224

0 commit comments

Comments
 (0)