From: <md...@us...> - 2008-07-31 13:51:05
|
Revision: 5934 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5934&view=rev Author: mdboom Date: 2008-07-31 13:50:58 +0000 (Thu, 31 Jul 2008) Log Message: ----------- Deal with markers correctly for interpolating transformations. (Thanks Jae-Joon Lee for finding this.) Modified Paths: -------------- trunk/matplotlib/examples/api/custom_projection_example.py trunk/matplotlib/lib/matplotlib/lines.py trunk/matplotlib/lib/matplotlib/transforms.py Modified: trunk/matplotlib/examples/api/custom_projection_example.py =================================================================== --- trunk/matplotlib/examples/api/custom_projection_example.py 2008-07-31 11:52:10 UTC (rev 5933) +++ trunk/matplotlib/examples/api/custom_projection_example.py 2008-07-31 13:50:58 UTC (rev 5934) @@ -451,6 +451,7 @@ from pylab import * subplot(111, projection="hammer") +p = plot([-1, 1, 1], [-1, -1, 1], "o-") grid(True) show() Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2008-07-31 11:52:10 UTC (rev 5933) +++ trunk/matplotlib/lib/matplotlib/lines.py 2008-07-31 13:50:58 UTC (rev 5934) @@ -432,7 +432,7 @@ gc.set_alpha(self._alpha) funcname = self._markers.get(self._marker, '_draw_nothing') if funcname != '_draw_nothing': - tpath, affine = self._transformed_path.get_transformed_path_and_affine() + tpath, affine = self._transformed_path.get_transformed_points_and_affine() markerFunc = getattr(self, funcname) markerFunc(renderer, gc, tpath, affine.frozen()) Modified: trunk/matplotlib/lib/matplotlib/transforms.py =================================================================== --- trunk/matplotlib/lib/matplotlib/transforms.py 2008-07-31 11:52:10 UTC (rev 5933) +++ trunk/matplotlib/lib/matplotlib/transforms.py 2008-07-31 13:50:58 UTC (rev 5934) @@ -2076,18 +2076,35 @@ self._transform = transform self.set_children(transform) self._transformed_path = None + self._transformed_points = None + def _revalidate(self): + if ((self._invalid & self.INVALID_NON_AFFINE == self.INVALID_NON_AFFINE) + or self._transformed_path is None): + self._transformed_path = \ + self._transform.transform_path_non_affine(self._path) + self._transformed_points = \ + Path(self._transform.transform_non_affine(self._path.vertices)) + self._invalid = 0 + + def get_transformed_points_and_affine(self): + """ + Return a copy of the child path, with the non-affine part of + the transform already applied, along with the affine part of + the path necessary to complete the transformation. Unlike + get_transformed_path_and_affine, no interpolation will be + performed. + """ + self._revalidate() + return self._transformed_points, self.get_affine() + def get_transformed_path_and_affine(self): """ Return a copy of the child path, with the non-affine part of the transform already applied, along with the affine part of the path necessary to complete the transformation. """ - if ((self._invalid & self.INVALID_NON_AFFINE == self.INVALID_NON_AFFINE) - or self._transformed_path is None): - self._transformed_path = \ - self._transform.transform_path_non_affine(self._path) - self._invalid = 0 + self._revalidate() return self._transformed_path, self.get_affine() def get_fully_transformed_path(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |