FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Numpyfy tick handling code in Axis3D. by anntzer · Pull Request #13364 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
36 changes: 14 additions & 22 deletions lib/mpl_toolkits/mplot3d/axis3d.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,8 @@ def draw(self, renderer):
self.line.draw(renderer)

# Grid points where the planes meet
xyz0 = []
for tick in ticks:
coord = minmax.copy()
coord[index] = tick.get_loc()
xyz0.append(coord)
xyz0 = np.tile(minmax, (len(ticks), 1))
xyz0[:, index] = [tick.get_loc() for tick in ticks]

# Draw labels
peparray = np.asanyarray(pep)
Expand Down Expand Up @@ -357,30 +354,25 @@ def draw(self, renderer):
self.offsetText.draw(renderer)

# Draw grid lines
if len(xyz0) > 0:
if self.axes._draw_grid and len(ticks):
# Grid points at end of one plane
xyz1 = copy.deepcopy(xyz0)
xyz1 = xyz0.copy()
newindex = (index + 1) % 3
newval = get_flip_min_max(xyz1[0], newindex, mins, maxs)
for i in range(len(ticks)):
xyz1[i][newindex] = newval
xyz1[:, newindex] = newval

# Grid points at end of the other plane
xyz2 = copy.deepcopy(xyz0)
xyz2 = xyz0.copy()
newindex = (index + 2) % 3
newval = get_flip_min_max(xyz2[0], newindex, mins, maxs)
for i in range(len(ticks)):
xyz2[i][newindex] = newval

lines = list(zip(xyz1, xyz0, xyz2))
if self.axes._draw_grid:
self.gridlines.set_segments(lines)
self.gridlines.set_color([info['grid']['color']] * len(lines))
self.gridlines.set_linewidth(
[info['grid']['linewidth']] * len(lines))
self.gridlines.set_linestyle(
[info['grid']['linestyle']] * len(lines))
self.gridlines.draw(renderer, project=True)
xyz2[:, newindex] = newval

lines = np.stack([xyz1, xyz0, xyz2], axis=1)
self.gridlines.set_segments(lines)
self.gridlines.set_color(info['grid']['color'])
self.gridlines.set_linewidth(info['grid']['linewidth'])
self.gridlines.set_linestyle(info['grid']['linestyle'])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

do we know if these setters are properly broadcasting the scalars?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

At least manually setting a scalar into any of these works.

self.gridlines.draw(renderer, project=True)

# Draw ticks
tickdir = info['tickdir']
Expand Down

Back | FazBrowse Home | New Git URL