def __init__(self): self.identity = mtransforms.IdentityTransform() self.identity2 = mtransforms.IdentityTransform() # Force use of the more complex composition. self.composite = mtransforms.CompositeGenericTransform( self.identity, self.identity2) # Check parent -> child links of TransformWrapper. self.wrapper = mtransforms.TransformWrapper(self.composite) # Check child -> parent links of TransformWrapper. self.composite2 = mtransforms.CompositeGenericTransform( self.wrapper, self.identity)
def _set_lim_and_transforms(self): """ This is called once when the plot is created to set up all the transforms for the data, text and grids. """ #Get the standard transform setup from the Axes base class Axes._set_lim_and_transforms(self) #Save the unskewed data transform for our own use when regenerating #the data transform. The user might want this as well self._transDataNonskew = self.transData #Create a wrapper for the data transform, so that any object that #grabs this transform will see an updated version when we change it self.transData = transforms.TransformWrapper( transforms.IdentityTransform()) #Create a wrapper for the proj. transform, so that any object that #grabs this transform will see an updated version when we change it self.transProjection = transforms.TransformWrapper( transforms.IdentityTransform()) self._update_data_transform()
def _set_lim_and_transforms(self): """Override transform initialization.""" # axis coords to display coords self.transAxes = transforms.BboxTransformTo(self.bbox) # X and Y axis scaling self.transScale = transforms.TransformWrapper( transforms.IdentityTransform()) # transform from given Bbox to unit Bbox # the given transformedBbox is updated every time the # viewLim changes or the transScale changes self.transLimits = transforms.BboxTransformFrom( transforms.TransformedBbox(self.viewLim, self.transScale)) # data to display coordinates self.transData = self.transScale + (self.transLimits + self.transAxes) # blended transforms for xaxis and yaxis self._xaxis_transform = transforms.blended_transform_factory( self.transData, self.transAxes) self._yaxis_transform = transforms.blended_transform_factory( self.transAxes, self.transData)
def _set_lim_and_transforms(self): # A view limit where the minimum radius can be locked if the user # specifies an alternate origin. self._originViewLim = mtransforms.LockableBbox(self.viewLim) # Handle angular offset and direction. self._direction = mtransforms.Affine2D() \ .scale(self._default_theta_direction, 1.0) self._theta_offset = mtransforms.Affine2D() \ .translate(self._default_theta_offset, 0.0) self.transShift = self._direction + self._theta_offset # A view limit shifted to the correct location after accounting for # orientation and offset. self._realViewLim = mtransforms.TransformedBbox( self.viewLim, self.transShift) # Transforms the x and y axis separately by a scale factor # It is assumed that this part will have non-linear components self.transScale = mtransforms.TransformWrapper( mtransforms.IdentityTransform()) # Scale view limit into a bbox around the selected wedge. This may be # smaller than the usual unit axes rectangle if not plotting the full # circle. self.axesLim = _WedgeBbox((0.5, 0.5), self._realViewLim, self._originViewLim) # Scale the wedge to fill the axes. self.transWedge = mtransforms.BboxTransformFrom(self.axesLim) # Scale the axes to fill the figure. self.transAxes = mtransforms.BboxTransformTo(self.bbox) # A (possibly non-linear) projection on the (already scaled) # data. This one is aware of rmin self.transProjection = self.PolarTransform( self, _apply_theta_transforms=False) # Add dependency on rorigin. self.transProjection.set_children(self._originViewLim) # An affine transformation on the data, generally to limit the # range of the axes self.transProjectionAffine = self.PolarAffine(self.transScale, self._originViewLim) # The complete data transformation stack -- from data all the # way to display coordinates self.transData = ( self.transScale + self.transShift + self.transProjection + (self.transProjectionAffine + self.transWedge + self.transAxes)) # This is the transform for theta-axis ticks. It is # equivalent to transData, except it always puts r == 0.0 and r == 1.0 # at the edge of the axis circles. self._xaxis_transform = (mtransforms.blended_transform_factory( mtransforms.IdentityTransform(), mtransforms.BboxTransformTo(self.viewLim)) + self.transData) # The theta labels are flipped along the radius, so that text 1 is on # the outside by default. This should work the same as before. flipr_transform = mtransforms.Affine2D() \ .translate(0.0, -0.5) \ .scale(1.0, -1.0) \ .translate(0.0, 0.5) self._xaxis_text_transform = flipr_transform + self._xaxis_transform # This is the transform for r-axis ticks. It scales the theta # axis so the gridlines from 0.0 to 1.0, now go from thetamin to # thetamax. self._yaxis_transform = (mtransforms.blended_transform_factory( mtransforms.BboxTransformTo(self.viewLim), mtransforms.IdentityTransform()) + self.transData) # The r-axis labels are put at an angle and padded in the r-direction self._r_label_position = mtransforms.Affine2D() \ .translate(self._default_rlabel_position, 0.0) self._yaxis_text_transform = mtransforms.TransformWrapper( self._r_label_position + self.transData)