示例#1
0
    def _update_polys(self):
        """ Updates the cache of contour polygons """
        if self.value.is_masked():
            # XXX masked data and get_data_mask not currently implemented
            data, mask = self.value.get_data_mask()
            mask &= isfinite(data)
        else:
            data = self.value.get_data()
            mask = isfinite(data)

        x_data, y_data = self.index.get_data()
        xs = x_data.get_data()
        ys = y_data.get_data()
        xg, yg = meshgrid(xs, ys)

        # note: contour wants mask True in invalid locations
        c = Cntr(xg, yg, data, ~mask)

        self._cached_contours = {}
        for i in range(len(self._levels)-1):
            key = (self._levels[i], self._levels[i+1])
            self._cached_polys[key] = []
            polys = c.trace(*key)
            for poly in polys:
                self._cached_polys[key].append(transpose(poly))
        self._poly_cache_valid = True
示例#2
0
    def _update_contours(self):
        """ Updates the cache of contour lines """
        if self.value.is_masked():
            # XXX masked data and get_data_mask not currently implemented
            data, mask = self.value.get_data_mask()
            mask &= isfinite(data)
        else:
            data = self.value.get_data()
            mask = isfinite(data)

        x_data, y_data = self.index.get_data()
        xs = x_data.get_data()
        ys = y_data.get_data()
        xg, yg = meshgrid(xs, ys)

        # note: contour wants mask True in invalid locations
        c = Cntr(xg, yg, data, ~mask)

        self._cached_contours = {}
        for level in self._levels:
            self._cached_contours[level] = []
            traces = c.trace(level)
            for trace in traces:
                self._cached_contours[level].append(transpose(trace))
        self._contour_cache_valid = True
示例#3
0
    def _update_contours(self):
        """ Updates the cache of contour lines """
        if self.value.is_masked():
            # XXX masked data and get_data_mask not currently implemented
            data, mask = self.value.get_data_mask()
            mask &= isfinite(data)
        else:
            data = self.value.get_data()
            mask = isfinite(data)

        x_data, y_data = self.index.get_data()
        xs = x_data.get_data()
        ys = y_data.get_data()
        xg, yg = meshgrid(xs, ys)

        # note: contour wants mask True in invalid locations
        c = Cntr(xg, yg, data, ~mask)

        self._cached_contours = {}
        for level in self._levels:
            self._cached_contours[level] = []
            traces = c.trace(level)
            for trace in traces:
                self._cached_contours[level].append(transpose(trace))
        self._contour_cache_valid = True
示例#4
0
 def _update_contours(self):
     """ Updates the cache of contour lines """
     # x and y data are "fenceposts" so ignore the last value
     # XXX: this truncation is causing errors in Cntr() as of r13735
     xdata = self.index._xdata.get_data()
     ydata = self.index._ydata.get_data()
     xs = linspace(xdata[0], xdata[-1], len(xdata)-1)
     ys = linspace(ydata[0], ydata[-1], len(ydata)-1)
     xg, yg = meshgrid(xs, ys)
     if self.orientation == "h":
         c = Cntr(xg, yg, self.value.raw_value)
     else:
         c = Cntr(xg, yg, self.value.raw_value.T)
     self._cached_contours = {}
     for level in self._levels:
         self._cached_contours[level] = []
         traces = c.trace(level)
         for trace in traces:
             self._cached_contours[level].append(transpose(trace))
     self._contour_cache_valid = True
示例#5
0
 def _update_contours(self):
     """ Updates the cache of contour lines """
     # x and ydata are "fenceposts" so ignore the last value
     # XXX: this truncaton is causing errors in Cntr() as of r13735
     xdata = self.index._xdata.get_data()
     ydata = self.index._ydata.get_data()
     xs = linspace(xdata[0], xdata[-1], len(xdata) - 1)
     ys = linspace(ydata[0], ydata[-1], len(ydata) - 1)
     xg, yg = meshgrid(xs, ys)
     if self.orientation == "h":
         c = Cntr(xg, yg, self.value.raw_value)
     else:
         c = Cntr(xg, yg, self.value.raw_value.T)
     self._cached_contours = {}
     for level in self._levels:
         self._cached_contours[level] = []
         traces = c.trace(level)
         for trace in traces:
             self._cached_contours[level].append(transpose(trace))
     self._contour_cache_valid = True
示例#6
0
 def _update_polys(self):
     """ Updates the cache of contour polygons """
     # x and ydata are "fenceposts" so ignore the last value
     # XXX: this truncation is causing errors in Cntr() as of r13735
     xdata = self.index._xdata.get_data()
     ydata = self.index._ydata.get_data()
     xs = linspace(xdata[0], xdata[-1], len(xdata)-1)
     ys = linspace(ydata[0], ydata[-1], len(ydata)-1)
     xg, yg = meshgrid(xs, ys)
     if self.orientation == "h":
         c = Cntr(xg, yg, self.value.raw_value)
     else:
         c = Cntr(xg, yg, self.value.raw_value.T)
     self._cached_contours = {}
     for i in range(len(self._levels)-1):
         key = (self._levels[i], self._levels[i+1])
         self._cached_polys[key] = []
         polys = c.trace(*key)
         for poly in polys:
             self._cached_polys[key].append(transpose(poly))
     self._poly_cache_valid = True
示例#7
0
 def _update_polys(self):
     """ Updates the cache of contour polygons """
     # x and ydata are "fenceposts" so ignore the last value
     # XXX: this truncation is causing errors in Cntr() as of r13735
     xdata = self.index._xdata.get_data()
     ydata = self.index._ydata.get_data()
     xs = linspace(xdata[0], xdata[-1], len(xdata) - 1)
     ys = linspace(ydata[0], ydata[-1], len(ydata) - 1)
     xg, yg = meshgrid(xs, ys)
     if self.orientation == "h":
         c = Cntr(xg, yg, self.value.raw_value)
     else:
         c = Cntr(xg, yg, self.value.raw_value.T)
     self._cached_contours = {}
     for i in range(len(self._levels) - 1):
         key = (self._levels[i], self._levels[i + 1])
         self._cached_polys[key] = []
         polys = c.trace(*key)
         for poly in polys:
             self._cached_polys[key].append(transpose(poly))
     self._poly_cache_valid = True