2525# interval as appropriate and see what parts of the tick to draw, if any.
2626class SkewXTick (maxis .XTick ):
2727 def draw (self , renderer ):
28- if not self .get_visible (): return
28+ if not self .get_visible ():
29+ return
2930 renderer .open_group (self .__name__ )
3031
3132 lower_interval = self .axes .xaxis .lower_interval
@@ -78,7 +79,7 @@ def __init__(self, axes, spine_type):
7879 else :
7980 loc = 1.0
8081 mspines .Spine .__init__ (self , axes , spine_type ,
81- mpath .Path ([(13 , loc ), (13 , loc )]))
82+ mpath .Path ([(13 , loc ), (13 , loc )]))
8283
8384 def _adjust_location (self ):
8485 trans = self .axes .transDataToAxes .inverted ()
@@ -89,7 +90,7 @@ def _adjust_location(self):
8990 left = trans .transform_point ((0.0 , yloc ))[0 ]
9091 right = trans .transform_point ((1.0 , yloc ))[0 ]
9192
92- pts = self ._path .vertices
93+ pts = self ._path .vertices
9394 pts [0 , 0 ] = left
9495 pts [1 , 0 ] = right
9596 self .axis .upper_interval = (left , right )
@@ -114,10 +115,10 @@ def _init_axis(self):
114115 self .spines ['right' ].register_axis (self .yaxis )
115116
116117 def _gen_axes_spines (self ):
117- spines = {'top' :SkewSpine (self , 'top' ),
118- 'bottom' :mspines .Spine .linear_spine (self , 'bottom' ),
119- 'left' :mspines .Spine .linear_spine (self , 'left' ),
120- 'right' :mspines .Spine .linear_spine (self , 'right' )}
118+ spines = {'top' : SkewSpine (self , 'top' ),
119+ 'bottom' : mspines .Spine .linear_spine (self , 'bottom' ),
120+ 'left' : mspines .Spine .linear_spine (self , 'left' ),
121+ 'right' : mspines .Spine .linear_spine (self , 'right' )}
121122 return spines
122123
123124 def _set_lim_and_transforms (self ):
@@ -135,23 +136,25 @@ def _set_lim_and_transforms(self):
135136 # coordinates thus performing the transform around the proper origin
136137 # We keep the pre-transAxes transform around for other users, like the
137138 # spines for finding bounds
138- self .transDataToAxes = self .transScale + (self .transLimits +
139- transforms .Affine2D ().skew_deg (rot , 0 ))
139+ self .transDataToAxes = (self .transScale +
140+ (self .transLimits +
141+ transforms .Affine2D ().skew_deg (rot , 0 )))
140142
141143 # Create the full transform from Data to Pixels
142144 self .transData = self .transDataToAxes + self .transAxes
143145
144146 # Blended transforms like this need to have the skewing applied using
145147 # both axes, in axes coords like before.
146148 self ._xaxis_transform = (transforms .blended_transform_factory (
147- self .transScale + self .transLimits ,
148- transforms .IdentityTransform ()) +
149- transforms .Affine2D ().skew_deg (rot , 0 )) + self .transAxes
149+ self .transScale + self .transLimits ,
150+ transforms .IdentityTransform ()) +
151+ transforms .Affine2D ().skew_deg (rot , 0 )) + self .transAxes
150152
151153# Now register the projection with matplotlib so the user can select
152154# it.
153155register_projection (SkewXAxes )
154156
157+
155158@image_comparison (baseline_images = ['skew_axes' ], remove_text = True )
156159def test_set_line_coll_dash_image ():
157160 fig = plt .figure ()
@@ -163,6 +166,7 @@ def test_set_line_coll_dash_image():
163166 # An example of a slanted line at constant X
164167 l = ax .axvline (0 , color = 'b' )
165168
169+
166170@image_comparison (baseline_images = ['skew_rects' ], remove_text = True )
167171def test_skew_rectange ():
168172
@@ -180,7 +184,8 @@ def test_skew_rectange():
180184 t = transforms .Affine2D ().skew_deg (xdeg , ydeg )
181185
182186 ax .set_title ('Skew of {0} in X and {1} in Y' .format (xdeg , ydeg ))
183- ax .add_patch (mpatch .Rectangle ([- 1 , - 1 ], 2 , 2 , transform = t + ax .transData ,
187+ ax .add_patch (mpatch .Rectangle ([- 1 , - 1 ], 2 , 2 ,
188+ transform = t + ax .transData ,
184189 alpha = 0.5 , facecolor = 'coral' ))
185190
186191 plt .subplots_adjust (wspace = 0 , left = 0 , right = 1 , bottom = 0 )
0 commit comments