@@ -839,8 +839,11 @@ def _init_axis(self):
839
839
self .spines ['polar' ].register_axis (self .yaxis )
840
840
841
841
def _set_lim_and_transforms (self ):
842
- # A view limit where the minimum radius can be locked if the user
843
- # specifies an alternate origin.
842
+ # self.viewLim is set by the superclass and contains (θ, r) as its (x, y)
843
+ # components.
844
+
845
+ # This is a view limit (still in (θ, r) space) where the minimum radius can be
846
+ # locked if the user specifies an alternate origin.
844
847
self ._originViewLim = mtransforms .LockableBbox (self .viewLim )
845
848
846
849
# Handle angular offset and direction.
@@ -849,83 +852,75 @@ def _set_lim_and_transforms(self):
849
852
self ._theta_offset = mtransforms .Affine2D () \
850
853
.translate (self ._default_theta_offset ,0.0 )
851
854
self .transShift = self ._direction + self ._theta_offset
852
- # A view limit shifted to the correct location after accounting for
853
- # orientation and offset.
854
- self ._realViewLim = mtransforms .TransformedBbox (self .viewLim ,
855
- self .transShift )
856
-
857
- # Transforms the x and y axis separately by a scale factor
858
- # It is assumed that this part will have non-linear components
859
- self .transScale = mtransforms .TransformWrapper (
860
- mtransforms .IdentityTransform ())
861
-
862
- # Scale view limit into a bbox around the selected wedge. This may be
863
- # smaller than the usual unit axes rectangle if not plotting the full
864
- # circle.
865
- self .axesLim = _WedgeBbox ((0.5 ,0.5 ),
866
- self ._realViewLim ,self ._originViewLim )
867
-
868
- # Scale the wedge to fill the axes.
855
+ # This is a view limit in (θ, r) shifted to the correct location after
856
+ # accounting for θ orientation and offset.
857
+ self ._realViewLim = mtransforms .TransformedBbox (self .viewLim ,self .transShift )
858
+
859
+ # Transforms the θ and r axis separately by a scale factor. It is assumed that
860
+ # this part will have the non-linear components.
861
+ self .transScale = mtransforms .TransformWrapper (mtransforms .IdentityTransform ())
862
+
863
+ # Scale view limit into a bbox around the selected wedge. This may be smaller
864
+ # than the usual unit axes rectangle if not plotting the full circle.
865
+ self .axesLim = _WedgeBbox ((0.5 ,0.5 ),self ._realViewLim ,self ._originViewLim )
866
+
867
+ # Scale the wedge to fill the Axes unit space.
869
868
self .transWedge = mtransforms .BboxTransformFrom (self .axesLim )
870
869
871
- # Scale theaxes to fill thefigure .
870
+ # Scale theAxes unit space to fill theAxes actual position .
872
871
self .transAxes = mtransforms .BboxTransformTo (self .bbox )
873
872
874
- # A (possibly non-linear) projection on the (already scaled)
875
- #data. This one is aware of rmin
873
+ # A (possibly non-linear) projection on the (already scaled) data. This one is
874
+ # aware of rmin.
876
875
self .transProjection = self .PolarTransform (
877
876
self ,
878
877
scale_transform = self .transScale
879
878
)
880
879
# Add dependency on rorigin.
881
880
self .transProjection .set_children (self ._originViewLim )
882
881
883
- # An affine transformation on the data, generally to limit the
884
- # range of the axes
882
+ # An affine transformation on the data, generally to limit the range of the axes
885
883
self .transProjectionAffine = self .PolarAffine (self .transScale ,
886
884
self ._originViewLim )
887
885
888
- # The complete data transformation stack -- from data all the
889
- # way to display coordinates
890
- #
891
- # 1. Remove any radial axis scaling (e.g. log scaling)
892
- # 2. Shift data in the theta direction
893
- # 3. Project the data from polar to cartesian values
894
- # (with the origin in the same place)
895
- # 4. Scale and translate the cartesian values to Axes coordinates
896
- # (here the origin is moved to the lower left of the Axes)
897
- # 5. Move and scale to fill the Axes
898
- # 6. Convert from Axes coordinates to Figure coordinates
886
+ # The complete data transformation stack -- from data all the way to display
887
+ # coordinates.
899
888
self .transData = (
889
+ # 1. Remove any radial axis scaling (e.g. log scaling).
900
890
self .transScale +
891
+ # 2. Shift data in the θ direction.
901
892
self .transShift +
893
+ # 3. Project the data from polar to cartesian values (with the origin in the
894
+ # same place).
902
895
self .transProjection +
903
896
(
897
+ # 4. Scale and translate the cartesian values to Axes coordinates (here
898
+ # the origin is moved to the lower left of the Axes).
904
899
self .transProjectionAffine +
900
+ # 5. Move and scale to fill the Axes.
905
901
self .transWedge +
902
+ # 6. Convert from Axes coordinates to Figure coordinates.
906
903
self .transAxes
907
904
)
908
905
)
909
906
910
- # This is the transform for theta-axis ticks. It is
911
- # equivalent to transData, except it always puts r == 0.0 and r == 1.0
912
- # at the edge of the axis circles.
907
+ # This is the transform for θ-axis ticks. It is equivalent to transData, except
908
+ # it always puts r == 0.0 and r == 1.0 at the edge of the axis circles.
913
909
self ._xaxis_transform = (
914
910
mtransforms .blended_transform_factory (
915
911
mtransforms .IdentityTransform (),
916
912
mtransforms .BboxTransformTo (self .viewLim ))+
917
913
self .transData )
918
- # Thetheta labels are flipped along the radius, so that text 1 is on
919
- #the outside by default. This should work the same as before.
914
+ # Theθ labels are flipped along the radius, so that text 1 is on the outside by
915
+ # default. This should work the same as before.
920
916
flipr_transform = mtransforms .Affine2D () \
921
917
.translate (0.0 ,- 0.5 ) \
922
918
.scale (1.0 ,- 1.0 ) \
923
919
.translate (0.0 ,0.5 )
924
920
self ._xaxis_text_transform = flipr_transform + self ._xaxis_transform
925
921
926
- # This is the transform for r-axis ticks. It scales the theta
927
- # axis so the gridlines from 0.0 to 1.0, now go from thetamin to
928
- # thetamax.
922
+ # This is the transform for r-axis ticks. It scales the θ-axis so the gridlines
923
+ # from 0.0 to 1.0, now go from thetamin to thetamax.
929
924
self ._yaxis_transform = (
930
925
mtransforms .blended_transform_factory (
931
926
mtransforms .BboxTransformTo (self .viewLim ),