Skip to content

Allow mplot3d rasterization; adjacent cleanups. #10158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2018
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
9 changes: 3 additions & 6 deletions lib/mpl_toolkits/mplot3d/art3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def set_3d_properties(self, z=0, zdir='z'):
self._dir_vec = get_dir_vector(zdir)
self.stale = True

@artist.allow_rasterization
def draw(self, renderer):
proj = proj3d.proj_trans_points(
[self._position3d, self._position3d + self._dir_vec], renderer.M)
Expand Down Expand Up @@ -155,6 +156,7 @@ def set_3d_properties(self, zs=0, zdir='z'):
self._verts3d = juggle_axes(xs, ys, zs, zdir)
self.stale = True

@artist.allow_rasterization
def draw(self, renderer):
xs3d, ys3d, zs3d = self._verts3d
xs, ys, zs = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M)
Expand Down Expand Up @@ -257,6 +259,7 @@ def do_3d_projection(self, renderer):
minz = min(minz, min(zs))
return minz

@artist.allow_rasterization
def draw(self, renderer, project=False):
if project:
self.do_3d_projection(renderer)
Expand Down Expand Up @@ -302,9 +305,6 @@ def do_3d_projection(self, renderer):
self._facecolor2d = self._facecolor3d
return min(vzs)

def draw(self, renderer):
Patch.draw(self, renderer)


class PathPatch3D(Patch3D):
"""
Expand Down Expand Up @@ -729,9 +729,6 @@ def get_facecolor(self):
def get_edgecolor(self):
return self._edgecolors2d

def draw(self, renderer):
return Collection.draw(self, renderer)


def poly_collection_2d_to_3d(col, zs=0, zdir='z'):
"""Convert a PolyCollection to a Poly3DCollection object."""
Expand Down
2 changes: 2 additions & 0 deletions lib/mpl_toolkits/mplot3d/axes3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import numpy as np

from matplotlib import artist
import matplotlib.axes as maxes
import matplotlib.cbook as cbook
import matplotlib.collections as mcoll
Expand Down Expand Up @@ -250,6 +251,7 @@ def tunit_edges(self, vals=None, M=None):
(tc[7], tc[4])]
return edges

@artist.allow_rasterization
def draw(self, renderer):
# draw the background patch
self.patch.draw(renderer)
Expand Down
13 changes: 6 additions & 7 deletions lib/mpl_toolkits/mplot3d/axis3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@

import six

import math
import copy

from matplotlib import lines as mlines, axis as maxis, patches as mpatches
from matplotlib import rcParams
from . import art3d
from . import proj3d
from matplotlib import (
artist, lines as mlines, axis as maxis, patches as mpatches, rcParams)
from . import art3d, proj3d

import numpy as np

Expand Down Expand Up @@ -222,6 +220,7 @@ def draw_pane(self, renderer):

renderer.close_group('pane3d')

@artist.allow_rasterization
def draw(self, renderer):
self.label._transform = self.axes.transData
renderer.open_group('axis3d')
Expand Down Expand Up @@ -299,7 +298,7 @@ def draw(self, renderer):
renderer.M)
self.label.set_position((tlx, tly))
if self.get_rotate_label(self.label.get_text()):
angle = art3d.norm_text_angle(math.degrees(math.atan2(dy, dx)))
angle = art3d.norm_text_angle(np.rad2deg(np.arctan2(dy, dx)))
self.label.set_rotation(angle)
self.label.set_va(info['label']['va'])
self.label.set_ha(info['label']['ha'])
Expand All @@ -322,7 +321,7 @@ def draw(self, renderer):
pos[0], pos[1], pos[2], renderer.M)
self.offsetText.set_text(self.major.formatter.get_offset())
self.offsetText.set_position((olx, oly))
angle = art3d.norm_text_angle(math.degrees(math.atan2(dy, dx)))
angle = art3d.norm_text_angle(np.rad2deg(np.arctan2(dy, dx)))
self.offsetText.set_rotation(angle)
# Must set rotation mode to "anchor" so that
# the alignment point is used as the "fulcrum" for rotation.
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy