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
14 changes: 4 additions & 10 deletions lib/matplotlib/_constrained_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,13 @@ def get_axall_tightbbox(ax, renderer):


def in_same_column(colnum0min, colnum0max, colnumCmin, colnumCmax):
if colnum0min >= colnumCmin and colnum0min <= colnumCmax:
return True
if colnum0max >= colnumCmin and colnum0max <= colnumCmax:
return True
return False
return (colnumCmin <= colnum0min <= colnumCmax
or colnumCmin <= colnum0max <= colnumCmax)


def in_same_row(rownum0min, rownum0max, rownumCmin, rownumCmax):
if rownum0min >= rownumCmin and rownum0min <= rownumCmax:
return True
if rownum0max >= rownumCmin and rownum0max <= rownumCmax:
return True
return False
return (rownumCmin <= rownum0min <= rownumCmax
or rownumCmin <= rownum0max <= rownumCmax)


######################################################
Expand Down
8 changes: 4 additions & 4 deletions lib/matplotlib/backends/backend_webagg_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,21 @@ def _handle_key(key):
code = int(key[key.index('k') + 1:])
value = chr(code)
# letter keys
if code >= 65 and code <= 90:
if 65 <= code <= 90:
if 'shift+' in key:
key = key.replace('shift+', '')
else:
value = value.lower()
# number keys
elif code >= 48 and code <= 57:
elif 48 <= code <= 57:
if 'shift+' in key:
value = ')!@#$%^&*('[int(value)]
key = key.replace('shift+', '')
# function keys
elif code >= 112 and code <= 123:
elif 112 <= code <= 123:
value = 'f%s' % (code - 111)
# number pad keys
elif code >= 96 and code <= 105:
elif 96 <= code <= 105:
value = '%s' % (code - 96)
# keys with shift alternatives
elif code in _SHIFT_LUT and 'shift+' in key:
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_wx.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ def set_linewidth(self, w):
w = float(w)
DEBUG_MSG("set_linewidth()", 1, self)
self.select()
if w > 0 and w < 1:
if 0 < w < 1:
w = 1
GraphicsContextBase.set_linewidth(self, w)
lw = int(self.renderer.points_to_pixels(self._linewidth))
Expand Down
3 changes: 1 addition & 2 deletions lib/matplotlib/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,7 @@ def draw(self, renderer):
combined_transform = transform
extents = paths[0].get_extents(combined_transform)
width, height = renderer.get_canvas_width_height()
if (extents.width < width and
extents.height < height):
if extents.width < width and extents.height < height:
do_single_path_optimization = True

if self._joinstyle:
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/mathtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ def _map_virtual_font(self, fontname, font_class, uniindex):
else:
lo = mid + 1

if uniindex >= range[0] and uniindex <= range[1]:
if range[0] <= uniindex <= range[1]:
uniindex = uniindex - range[0] + range[3]
fontname = range[2]
elif not doing_sans_conversion:
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/projections/polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,7 @@ def start_pan(self, x, y, button):
if button == 1:
epsilon = np.pi / 45.0
t, r = self.transData.inverted().transform_point((x, y))
if t >= angle - epsilon and t <= angle + epsilon:
if angle - epsilon <= t <= angle + epsilon:
mode = 'drag_r_labels'
elif button == 3:
mode = 'zoom'
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ def figure(num=None, # autoincrement if None, else integer from 1-N
if figManager is None:
max_open_warning = rcParams['figure.max_open_warning']

if (max_open_warning >= 1 and len(allnums) >= max_open_warning):
if len(allnums) >= max_open_warning >= 1:
warnings.warn(
"More than %d figures have been opened. Figures "
"created through the pyplot interface "
Expand Down
12 changes: 6 additions & 6 deletions lib/matplotlib/ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2413,25 +2413,25 @@ def tick_values(self, vmin, vmax):
# major ticks
if not self.minor:
ticklocs = []
if (decade_min <= -1):
if decade_min <= -1:
expo = np.arange(decade_min, min(0, decade_max + 1))
ticklocs.extend(list(10**expo))
if (decade_min <= 0) and (decade_max >= 0):
if decade_min <= 0 <= decade_max:
ticklocs.append(0.5)
if (decade_max >= 1):
if decade_max >= 1:
expo = -np.arange(max(1, decade_min), decade_max + 1)
ticklocs.extend(list(1 - 10**expo))

# minor ticks
else:
ticklocs = []
if (decade_min <= -2):
if decade_min <= -2:
expo = np.arange(decade_min, min(-1, decade_max))
newticks = np.outer(np.arange(2, 10), 10**expo).ravel()
ticklocs.extend(list(newticks))
if (decade_min <= 0) and (decade_max >= 0):
if decade_min <= 0 <= decade_max:
ticklocs.extend([0.2, 0.3, 0.4, 0.6, 0.7, 0.8])
if (decade_max >= 2):
if decade_max >= 2:
expo = -np.arange(max(2, decade_min), decade_max + 1)
newticks = 1 - np.outer(np.arange(2, 10), 10**expo).ravel()
ticklocs.extend(list(newticks))
Expand Down