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
8 changes: 2 additions & 6 deletions lib/mpl_toolkits/axisartist/axislines.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,7 @@ def get_gridlines(self, which="major", axis="both"):
locs.extend(self.axes.xaxis.major.locator())
if which in ("both", "minor"):
locs.extend(self.axes.xaxis.minor.locator())

for x in locs:
gridlines.append([[x, x], [y1, y2]])
gridlines.extend([[x, x], [y1, y2]] for x in locs)

if axis in ("both", "y"):
x1, x2 = self.axes.get_xlim()
Expand All @@ -365,9 +363,7 @@ def get_gridlines(self, which="major", axis="both"):
locs.extend(self.axes.yaxis.major.locator())
if self.axes.yaxis._minor_tick_kw["gridOn"]:
locs.extend(self.axes.yaxis.minor.locator())

for y in locs:
gridlines.append([[x1, x2], [y, y]])
gridlines.extend([[x1, x2], [y, y]] for y in locs)

return gridlines

Expand Down
5 changes: 3 additions & 2 deletions lib/mpl_toolkits/axisartist/grid_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@ def _find_line_box_crossings(xys, bbox):
umin, vmin = bbox.min[sl]
umax, vmax = bbox.max[sl]
for u0, inside in [(umin, us > umin), (umax, us < umax)]:
crossings.append([])
cross = []
idxs, = (inside[:-1] ^ inside[1:]).nonzero()
for idx in idxs:
v = vs[idx] + (u0 - us[idx]) * dvs[idx] / dus[idx]
if not vmin <= v <= vmax:
continue
crossing = (u0, v)[sl]
theta = np.degrees(np.arctan2(*dxys[idx][::-1]))
crossings[-1].append((crossing, theta))
cross.append((crossing, theta))
crossings.append(cross)
return crossings


Expand Down