8000 Minor cleanups. · matplotlib/matplotlib@a9d1cdf · GitHub
[go: up one dir, main page]

Skip to content

Commit a9d1cdf

Browse files
committed
Minor cleanups.
1 parent e086a5d commit a9d1cdf

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

lib/matplotlib/scale.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ def limit_range_for_scale(self, vmin, vmax, minpos):
262262
"""
263263
Limit the domain to positive values.
264264
"""
265-
return (vmin <= 0.0 and minpos or vmin,
266-
vmax <= 0.0 and minpos or vmax)
265+
return (minpos if vmin <= 0 else vmin,
266+
minpos if vmax <= 0 else vmax)
267267

268268

269269
class SymmetricalLogTransform(Transform):
@@ -497,8 +497,8 @@ def limit_range_for_scale(self, vmin, vmax, minpos):
497497
"""
498498
Limit the domain to values between 0 and 1 (excluded).
499499
"""
500-
return (vmin <= 0 and minpos or vmin,
501-
vmax >= 1 and (1 - minpos) or vmax)
500+
return (minpos if vmin <= 0 else minpos,
501+
1 - minpos if vmax >= 1 else vmax)
502502

503503

504504
_scale_mapping = {

lib/matplotlib/streamplot.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
141141

142142
# Check if start_points are outside the data boundaries
143143
for xs, ys in sp2:
144-
if (xs < grid.x_origin or xs > grid.x_origin + grid.width
145-
or ys < grid.y_origin or ys > grid.y_origin + grid.height):
146-
raise ValueError("Starting point ({}, {}) outside of"
147-
" data boundaries".format(xs, ys))
144+
if not (grid.x_origin <= xs <= grid.x_origin + grid.width
145+
and grid.y_origin <= ys <= grid.y_origin + grid.height):
146+
raise ValueError("Starting point ({}, {}) outside of data "
147+
"boundaries".format(xs, ys))
148148

149149
# Convert start_points from data to array coords
150150
# Shift the seed points from the bottom left of the data so that

0 commit comments

Comments
 (0)
0