Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b1e5b9a

Browse filesBrowse files
authored
Merge pull request #10158 from anntzer/mplot3d-rasterization
Allow mplot3d rasterization; adjacent cleanups.
2 parents 84a4e95 + 83d3cf5 commit b1e5b9a
Copy full SHA for b1e5b9a

File tree

Expand file treeCollapse file tree

3 files changed

+11
-13
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+11
-13
lines changed

‎lib/mpl_toolkits/mplot3d/art3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/art3d.py
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def set_3d_properties(self, z=0, zdir='z'):
107107
self._dir_vec = get_dir_vector(zdir)
108108
self.stale = True
109109

110+
@artist.allow_rasterization
110111
def draw(self, renderer):
111112
proj = proj3d.proj_trans_points(
112113
[self._position3d, self._position3d + self._dir_vec], renderer.M)
@@ -155,6 +156,7 @@ def set_3d_properties(self, zs=0, zdir='z'):
155156
self._verts3d = juggle_axes(xs, ys, zs, zdir)
156157
self.stale = True
157158

159+
@artist.allow_rasterization
158160
def draw(self, renderer):
159161
xs3d, ys3d, zs3d = self._verts3d
160162
xs, ys, zs = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M)
@@ -257,6 +259,7 @@ def do_3d_projection(self, renderer):
257259
minz = min(minz, min(zs))
258260
return minz
259261

262+
@artist.allow_rasterization
260263
def draw(self, renderer, project=False):
261264
if project:
262265
self.do_3d_projection(renderer)
@@ -302,9 +305,6 @@ def do_3d_projection(self, renderer):
302305
self._facecolor2d = self._facecolor3d
303306
return min(vzs)
304307

305-
def draw(self, renderer):
306-
Patch.draw(self, renderer)
307-
308308

309309
class PathPatch3D(Patch3D):
310310
"""
@@ -729,9 +729,6 @@ def get_facecolor(self):
729729
def get_edgecolor(self):
730730
return self._edgecolors2d
731731

732-
def draw(self, renderer):
733-
return Collection.draw(self, renderer)
734-
735732

736733
def poly_collection_2d_to_3d(col, zs=0, zdir='z'):
737734
"""Convert a PolyCollection to a Poly3DCollection object."""

‎lib/mpl_toolkits/mplot3d/axes3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/axes3d.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import numpy as np
2323

24+
from matplotlib import artist
2425
import matplotlib.axes as maxes
2526
import matplotlib.cbook as cbook
2627
import matplotlib.collections as mcoll
@@ -250,6 +251,7 @@ def tunit_edges(self, vals=None, M=None):
250251
(tc[7], tc[4])]
251252
return edges
252253

254+
@artist.allow_rasterization
253255
def draw(self, renderer):
254256
# draw the background patch
255257
self.patch.draw(renderer)

‎lib/mpl_toolkits/mplot3d/axis3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/axis3d.py
+6-7Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@
77

88
import six
99

10-
import math
1110
import copy
1211

13-
from matplotlib import lines as mlines, axis as maxis, patches as mpatches
14-
from matplotlib import rcParams
15-
from . import art3d
16-
from . import proj3d
12+
from matplotlib import (
13+
artist, lines as mlines, axis as maxis, patches as mpatches, rcParams)
14+
from . import art3d, proj3d
1715

1816
import numpy as np
1917

@@ -222,6 +220,7 @@ def draw_pane(self, renderer):
222220

223221
renderer.close_group('pane3d')
224222

223+
@artist.allow_rasterization
225224
def draw(self, renderer):
226225
self.label._transform = self.axes.transData
227226
renderer.open_group('axis3d')
@@ -299,7 +298,7 @@ def draw(self, renderer):
299298
renderer.M)
300299
self.label.set_position((tlx, tly))
301300
if self.get_rotate_label(self.label.get_text()):
302-
angle = art3d.norm_text_angle(math.degrees(math.atan2(dy, dx)))
301+
angle = art3d.norm_text_angle(np.rad2deg(np.arctan2(dy, dx)))
303302
self.label.set_rotation(angle)
304303
self.label.set_va(info['label']['va'])
305304
self.label.set_ha(info['label']['ha'])
@@ -322,7 +321,7 @@ def draw(self, renderer):
322321
pos[0], pos[1], pos[2], renderer.M)
323322
self.offsetText.set_text(self.major.formatter.get_offset())
324323
self.offsetText.set_position((olx, oly))
325-
angle = art3d.norm_text_angle(math.degrees(math.atan2(dy, dx)))
324+
angle = art3d.norm_text_angle(np.rad2deg(np.arctan2(dy, dx)))
326325
self.offsetText.set_rotation(angle)
327326
# Must set rotation mode to "anchor" so that
328327
# the alignment point is used as the "fulcrum" for rotation.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.