@@ -56,7 +56,7 @@ def __init__(self, fig, rect=None, *args, **kwargs):
56
56
*sharez* Other axes to share z-limits with
57
57
================ =========================================
58
58
59
- .. versionadded :: 1.2.0
59
+ .. versionadded :: 1.2.1
60
60
*sharez*
61
61
62
62
''' % {'scale' : ' | ' .join ([repr (x ) for x in mscale .get_scale_names ()])}
@@ -65,8 +65,6 @@ def __init__(self, fig, rect=None, *args, **kwargs):
65
65
rect = [0.0 , 0.0 , 1.0 , 1.0 ]
66
66
self ._cids = []
67
67
68
- # TODO: Support z-axis sharing
69
-
70
68
self .initial_azim = kwargs .pop ('azim' , - 60 )
71
69
self .initial_elev = kwargs .pop ('elev' , 30 )
72
70
zscale = kwargs .pop ('zscale' , None )
@@ -125,22 +123,28 @@ def set_axis_on(self):
125
123
self ._axis3don = True
126
124
127
125
def have_units (self ):
128
- 'Return *True* if units are set on the *x*, *y*, or *z* axes'
126
+ """
127
+ Return *True* if units are set on the *x*, *y*, or *z* axes
128
+
129
+ """
129
130
return (self .xaxis .have_units () or self .yaxis .have_units () or
130
131
self .zaxis .have_units ())
131
132
132
133
def convert_zunits (self , z ):
133
- """For artists in an axes, if the zaxis has units support,
134
+ """
135
+ For artists in an axes, if the zaxis has units support,
134
136
convert *z* using zaxis unit type
135
137
136
- .. versionadded :: 1.2.0
138
+ .. versionadded :: 1.2.1
139
+
137
140
"""
138
141
return self .zaxis .convert_units (z )
139
142
140
143
def _process_unit_info (self , xdata = None , ydata = None , zdata = None ,
141
144
kwargs = None ):
142
145
"""
143
146
Look for unit *kwargs* and update the axis instances as necessary
147
+
144
148
"""
145
149
Axes ._process_unit_info (self , xdata = xdata , ydata = ydata , kwargs = kwargs )
146
150
@@ -154,8 +158,8 @@ def _process_unit_info(self, xdata=None, ydata=None, zdata=None,
154
158
155
159
# process kwargs 2nd since these will override default units
156
160
if kwargs is not None :
157
- zunits = kwargs .pop ( 'zunits' , self .zaxis .units )
158
- if zunits != self .zaxis .units :
161
+ zunits = kwargs .pop ('zunits' , self .zaxis .units )
162
+ if zunits != self .zaxis .units :
159
163
self .zaxis .set_units (zunits )
160
164
# If the units being set imply a different converter,
161
165
# we need to update.
@@ -461,7 +465,7 @@ def autoscale_view(self, tight=None, scalex=True, scaley=True,
461
465
Function signature was changed to better match the 2D version.
462
466
*tight* is now explicitly a kwarg and placed first.
463
467
464
- .. versionchanged :: 1.2.0
468
+ .. versionchanged :: 1.2.1
465
469
This is now fully functional.
466
470
467
471
"""
@@ -551,12 +555,12 @@ def _determine_lims(self, xmin=None, xmax=None, *args, **kwargs):
551
555
return (xmin , xmax )
552
556
553
557
def set_xlim3d (self , left = None , right = None , emit = True , auto = False , ** kw ):
554
- '''
558
+ """
555
559
Set 3D x limits.
556
560
557
561
See :meth:`matplotlib.axes.Axes.set_xlim` for full documentation.
558
562
559
- '''
563
+ """
560
564
if 'xmin' in kw :
561
565
left = kw .pop ('xmin' )
562
566
if 'xmax' in kw :
@@ -565,7 +569,7 @@ def set_xlim3d(self, left=None, right=None, emit=True, auto=False, **kw):
565
569
raise ValueError ("unrecognized kwargs: %s" % kw .keys ())
566
570
567
571
if right is None and iterable (left ):
568
- left ,right = left
572
+ left , right = left
569
573
570
574
self ._process_unit_info (xdata = (left , right ))
571
575
if left is not None :
@@ -574,13 +578,15 @@ def set_xlim3d(self, left=None, right=None, emit=True, auto=False, **kw):
574
578
right = self .convert_xunits (right )
575
579
576
580
old_left , old_right = self .get_xlim ()
577
- if left is None : left = old_left
578
- if right is None : right = old_right
581
+ if left is None :
582
+ left = old_left
583
+ if right is None :
584
+ right = old_right
579
585
580
- if left == right :
586
+ if left == right :
581
587
warnings .warn (('Attempting to set identical left==right results\n '
582
- + 'in singular transformations; automatically expanding.\n '
583
- + 'left=%s, right=%s' ) % (left , right ))
588
+ 'in singular transformations; automatically expanding.\n '
589
+ 'left=%s, right=%s' ) % (left , right ))
584
590
left , right = mtransforms .nonsingular (left , right , increasing = False )
585
591
left , right = self .xaxis .limit_range_for_scale (left , right )
586
592
self .xy_viewLim .intervalx = (left , right )
@@ -604,12 +610,12 @@ def set_xlim3d(self, left=None, right=None, emit=True, auto=False, **kw):
604
610
605
611
606
612
def set_ylim3d (self , bottom = None , top = None , emit = True , auto = False , ** kw ):
607
- '''
613
+ """
608
614
Set 3D y limits.
609
615
610
616
See :meth:`matplotlib.axes.Axes.set_ylim` for full documentation.
611
617
612
- '''
618
+ """
613
619
if 'ymin' in kw :
614
620
bottom = kw .pop ('ymin' )
615
621
if 'ymax' in kw :
@@ -618,7 +624,7 @@ def set_ylim3d(self, bottom=None, top=None, emit=True, auto=False, **kw):
618
624
raise ValueError ("unrecognized kwargs: %s" % kw .keys ())
619
625
620
626
if top is None and iterable (bottom ):
621
- bottom ,top = bottom
627
+ bottom , top = bottom
622
628
623
629
self ._process_unit_info (ydata = (bottom , top ))
624
630
if bottom is not None :
@@ -627,13 +633,15 @@ def set_ylim3d(self, bottom=None, top=None, emit=True, auto=False, **kw):
627
633
top = self .convert_yunits (top )
628
634
629
635
old_bottom , old_top = self .get_ylim ()
630
- if bottom is None : bottom = old_bottom
631
- if top is None : top = old_top
636
+ if bottom is None :
637
+ bottom = old_bottom
638
+ if top is None :
639
+ top = old_top
632
640
633
- if top == bottom :
641
+ if top == bottom :
634
642
warnings .warn (('Attempting to set identical bottom==top results\n '
635
- + 'in singular transformations; automatically expanding.\n '
636
- + 'bottom=%s, top=%s' ) % (bottom , top ))
643
+ 'in singular transformations; automatically expanding.\n '
644
+ 'bottom=%s, top=%s' ) % (bottom , top ))
637
645
bottom , top = mtransforms .nonsingular (bottom , top , increasing = False )
638
646
bottom , top = self .yaxis .limit_range_for_scale (bottom , top )
639
647
self .xy_viewLim .intervaly = (bottom , top )
@@ -656,12 +664,12 @@ def set_ylim3d(self, bottom=None, top=None, emit=True, auto=False, **kw):
656
664
set_ylim = set_ylim3d
657
665
658
666
def set_zlim3d (self , bottom = None , top = None , emit = True , auto = False , ** kw ):
659
- '''
667
+ """
660
668
Set 3D z limits.
661
669
662
670
See :meth:`matplotlib.axes.Axes.set_ylim` for full documentation
663
- .
664
- '''
671
+
672
+ """
665
673
if 'zmin' in kw :
666
674
bottom = kw .pop ('zmin' )
667
675
if 'zmax' in kw :
@@ -670,7 +678,7 @@ def set_zlim3d(self, bottom=None, top=None, emit=True, auto=False, **kw):
670
678
raise ValueError ("unrecognized kwargs: %s" % kw .keys ())
671
679
672
680
if top is None and iterable (bottom ):
673
- bottom ,top = bottom
681
+ bottom , top = bottom
674
682
675
683
self ._process_unit_info (zdata = (bottom , top ))
676
684
if bottom is not None :
@@ -679,13 +687,15 @@ def set_zlim3d(self, bottom=None, top=None, emit=True, auto=False, **kw):
679
687
top = self .convert_zunits (top )
680
688
681
689
old_bottom , old_top = self .get_zlim ()
682
- if bottom is None : bottom = old_bottom
683
- if top is None : top = old_top
690
+ if bottom is None :
691
+ bottom = old_bottom
692
+ if top is None :
693
+ top = old_top
684
694
685
- if top == bottom :
695
+ if top == bottom :
686
696
warnings .warn (('Attempting to set identical bottom==top results\n '
687
- + 'in singular transformations; automatically expanding.\n '
688
- + 'bottom=%s, top=%s' ) % (bottom , top ))
697
+ 'in singular transformations; automatically expanding.\n '
698
+ 'bottom=%s, top=%s' ) % (bottom , top ))
689
699
bottom , top = mtransforms .nonsingular (bottom , top , increasing = False )
690
700
bottom , top = self .zaxis .limit_range_for_scale (bottom , top )
691
701
self .zz_viewLim .intervalx = (bottom , top )
@@ -2149,7 +2159,7 @@ def scatter(self, xs, ys, zs=0, zdir='z', s=20, c='b', *args, **kwargs):
2149
2159
is_2d = False
2150
2160
art3d .patch_collection_2d_to_3d (patches , zs = zs , zdir = zdir )
2151
2161
2152
- if self ._zmargin < 0.05 and xs .size > 0 :
2162
+ if self ._zmargin < 0.05 and xs .size > 0 :
2153
2163
self .set_zmargin (0.05 )
2154
2164
2155
2165
#FIXME: why is this necessary?
0 commit comments