Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit6a5fd7b

Browse files
committed
polar: Clarify some of the documenting comments on transforms
1 parentc1fc073 commit6a5fd7b

File tree

1 file changed

+38
-43
lines changed

1 file changed

+38
-43
lines changed

‎lib/matplotlib/projections/polar.py

Lines changed: 38 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -839,8 +839,11 @@ def _init_axis(self):
839839
self.spines['polar'].register_axis(self.yaxis)
840840

841841
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.
844847
self._originViewLim=mtransforms.LockableBbox(self.viewLim)
845848

846849
# Handle angular offset and direction.
@@ -849,83 +852,75 @@ def _set_lim_and_transforms(self):
849852
self._theta_offset=mtransforms.Affine2D() \
850853
.translate(self._default_theta_offset,0.0)
851854
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.
869868
self.transWedge=mtransforms.BboxTransformFrom(self.axesLim)
870869

871-
# Scale theaxesto fill thefigure.
870+
# Scale theAxes unit spaceto fill theAxes actual position.
872871
self.transAxes=mtransforms.BboxTransformTo(self.bbox)
873872

874-
# A (possibly non-linear) projection on the (already scaled)
875-
#data. This one isaware of rmin
873+
# A (possibly non-linear) projection on the (already scaled) data. This one is
874+
# aware of rmin.
876875
self.transProjection=self.PolarTransform(
877876
self,
878877
scale_transform=self.transScale
879878
)
880879
# Add dependency on rorigin.
881880
self.transProjection.set_children(self._originViewLim)
882881

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
885883
self.transProjectionAffine=self.PolarAffine(self.transScale,
886884
self._originViewLim)
887885

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.
899888
self.transData= (
889+
# 1. Remove any radial axis scaling (e.g. log scaling).
900890
self.transScale+
891+
# 2. Shift data in the θ direction.
901892
self.transShift+
893+
# 3. Project the data from polar to cartesian values (with the origin in the
894+
# same place).
902895
self.transProjection+
903896
(
897+
# 4. Scale and translate the cartesian values to Axes coordinates (here
898+
# the origin is moved to the lower left of the Axes).
904899
self.transProjectionAffine+
900+
# 5. Move and scale to fill the Axes.
905901
self.transWedge+
902+
# 6. Convert from Axes coordinates to Figure coordinates.
906903
self.transAxes
907904
)
908905
)
909906

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.
913909
self._xaxis_transform= (
914910
mtransforms.blended_transform_factory(
915911
mtransforms.IdentityTransform(),
916912
mtransforms.BboxTransformTo(self.viewLim))+
917913
self.transData)
918-
# Thetheta labels are flipped along the radius, so that text 1 is on
919-
#the outside bydefault. 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.
920916
flipr_transform=mtransforms.Affine2D() \
921917
.translate(0.0,-0.5) \
922918
.scale(1.0,-1.0) \
923919
.translate(0.0,0.5)
924920
self._xaxis_text_transform=flipr_transform+self._xaxis_transform
925921

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.
929924
self._yaxis_transform= (
930925
mtransforms.blended_transform_factory(
931926
mtransforms.BboxTransformTo(self.viewLim),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp