7
7
8
8
import six
9
9
10
- import math
11
10
import copy
12
11
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
17
15
18
16
import numpy as np
19
17
@@ -223,6 +221,7 @@ def draw_pane(self, renderer):
223
221
224
222
renderer .close_group ('pane3d' )
225
223
224
+ @artist .allow_rasterization
226
225
def draw (self , renderer ):
227
226
self .label ._transform = self .axes .transData
228
227
renderer .open_group ('axis3d' )
@@ -300,31 +299,30 @@ def draw(self, renderer):
300
299
renderer .M )
301
300
self .label .set_position ((tlx , tly ))
302
301
if self .get_rotate_label (self .label .get_text ()):
303
- angle = art3d .norm_text_angle (math . degrees ( math . atan2 (dy , dx )))
302
+ angle = art3d .norm_text_angle (np . rad2deg ( np . arctan2 (dy , dx )))
304
303
self .label .set_rotation (angle )
305
304
self .label .set_va (info ['label' ]['va' ])
306
305
self .label .set_ha (info ['label' ]['ha' ])
307
306
self .label .draw (renderer )
308
307
309
-
310
308
# Draw Offset text
311
309
312
310
# Which of the two edge points do we want to
313
311
# use for locating the offset text?
314
- if juggled [2 ] == 2 :
312
+ if juggled [2 ] == 2 :
315
313
outeredgep = edgep1
316
314
outerindex = 0
317
- else :
315
+ else :
318
316
outeredgep = edgep2
319
317
outerindex = 1
320
318
321
319
pos = copy .copy (outeredgep )
322
320
pos = move_from_center (pos , centers , labeldeltas , axmask )
323
321
olx , oly , olz = proj3d .proj_transform (
324
322
pos [0 ], pos [1 ], pos [2 ], renderer .M )
325
- self .offsetText .set_text ( self .major .formatter .get_offset () )
326
- self .offsetText .set_position ( (olx , oly ) )
327
- angle = art3d .norm_text_angle (math . degrees ( math . atan2 (dy , dx )))
323
+ self .offsetText .set_text (self .major .formatter .get_offset ())
324
+ self .offsetText .set_position ((olx , oly ))
325
+ angle = art3d .norm_text_angle (np . rad2deg ( np . arctan2 (dy , dx )))
328
326
self .offsetText .set_rotation (angle )
329
327
# Must set rotation mode to "anchor" so that
330
328
# the alignment point is used as the "fulcrum" for rotation.
@@ -345,29 +343,29 @@ def draw(self, renderer):
345
343
# Three-letters (e.g., TFT, FTT) are short-hand for the array of bools
346
344
# from the variable 'highs'.
347
345
# ---------------------------------------------------------------------
348
- if centpt [info ['tickdir' ]] > peparray [info ['tickdir' ], outerindex ] :
346
+ if centpt [info ['tickdir' ]] > peparray [info ['tickdir' ], outerindex ]:
349
347
# if FT and if highs has an even number of Trues
350
348
if (centpt [index ] <= peparray [index , outerindex ]
351
- and ((len (highs .nonzero ()[0 ]) % 2 ) == 0 )) :
349
+ and ((len (highs .nonzero ()[0 ]) % 2 ) == 0 )):
352
350
# Usually, this means align right, except for the FTT case,
353
351
# in which offset for axis 1 and 2 are aligned left.
354
- if highs .tolist () == [False , True , True ] and index in (1 , 2 ) :
352
+ if highs .tolist () == [False , True , True ] and index in (1 , 2 ):
355
353
align = 'left'
356
- else :
354
+ else :
357
355
align = 'right'
358
- else :
356
+ else :
359
357
# The FF case
360
358
align = 'left'
361
- else :
359
+ else :
362
360
# if TF and if highs has an even number of Trues
363
361
if (centpt [index ] > peparray [index , outerindex ]
364
- and (( len (highs .nonzero ()[0 ]) % 2 ) == 0 )) :
362
+ and len (highs .nonzero ()[0 ]) % 2 == 0 ):
365
363
# Usually mean align left, except if it is axis 2
366
- if index == 2 :
364
+ if index == 2 :
367
365
align = 'right'
368
- else :
366
+ else :
369
367
align = 'left'
370
- else :
368
+ else :
371
369
# The TT case
372
370
align = 'right'
373
371
@@ -462,7 +460,7 @@ def set_view_interval(self, vmin, vmax, ignore=False):
462
460
463
461
# TODO: Get this to work properly when mplot3d supports
464
462
# the transforms framework.
465
- def get_tightbbox (self , renderer ) :
463
+ def get_tightbbox (self , renderer ):
466
464
# Currently returns None so that Axis.get_tightbbox
467
465
# doesn't return junk info.
468
466
return None
0 commit comments