@@ -946,6 +946,7 @@ def _process_args(self, *args, **kwargs):
946946 min = seg .min (axis = 0 )
947947 max = seg .max (axis = 0 )
948948 havelimits = True
949+
949950 if havelimits :
950951 self .ax .update_datalim ([min , max ])
951952 self .ax .autoscale_view (tight = True )
@@ -1291,17 +1292,31 @@ def _process_args(self, *args, **kwargs):
12911292 self .zmax = args [0 ].zmax
12921293 else :
12931294 x , y , z = self ._contour_args (args , kwargs )
1294-
1295+
1296+ _mask = ma .getmask (z )
1297+ if _mask is ma .nomask :
1298+ _mask = None
1299+ C = _cntr .Cntr (x , y , z .filled (), _mask )
1300+
1301+ t = self .ax .transData if self .transform is None else self .transform
1302+
1303+ # if the transform is not trans data, and some part of it
1304+ # contains transData, transform the xs and ys to data coordinates
1305+ if (t != self .ax .transData and
1306+ any (t .contains_branch_seperately (self .ax .transData ))):
1307+ trans_to_data = self .transform - self .ax .transData
1308+ pts = (np .vstack ([x .flat , y .flat ]).T )
1309+ transformed_pts = trans_to_data .transform (pts )
1310+ x = transformed_pts [..., 0 ]
1311+ y = transformed_pts [..., 1 ]
1312+
12951313 x0 = ma .minimum (x )
12961314 x1 = ma .maximum (x )
12971315 y0 = ma .minimum (y )
12981316 y1 = ma .maximum (y )
12991317 self .ax .update_datalim ([(x0 ,y0 ), (x1 ,y1 )])
13001318 self .ax .autoscale_view (tight = True )
1301- _mask = ma .getmask (z )
1302- if _mask is ma .nomask :
1303- _mask = None
1304- C = _cntr .Cntr (x , y , z .filled (), _mask )
1319+
13051320 self .Cntr = C
13061321
13071322 def _get_allsegs_and_allkinds (self ):
0 commit comments