当前位置: 首页>>代码示例>>Python>>正文


Python cbook.delete_masked_points方法代码示例

本文整理汇总了Python中matplotlib.cbook.delete_masked_points方法的典型用法代码示例。如果您正苦于以下问题:Python cbook.delete_masked_points方法的具体用法?Python cbook.delete_masked_points怎么用?Python cbook.delete_masked_points使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.cbook的用法示例。


在下文中一共展示了cbook.delete_masked_points方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: set_offsets

# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import delete_masked_points [as 别名]
def set_offsets(self, xy):
        """
        Set the offsets for the barb polygons.  This saves the offsets passed
        in and actually sets version masked as appropriate for the existing
        U/V data. *offsets* should be a sequence.

        Parameters
        ----------
        offsets : sequence of pairs of floats
        """
        self.x = xy[:, 0]
        self.y = xy[:, 1]
        x, y, u, v = delete_masked_points(self.x.ravel(), self.y.ravel(),
                                          self.u, self.v)
        _check_consistent_shapes(x, y, u, v)
        xy = np.column_stack((x, y))
        mcollections.PolyCollection.set_offsets(self, xy)
        self.stale = True 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:20,代码来源:quiver.py

示例2: set_offsets

# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import delete_masked_points [as 别名]
def set_offsets(self, xy):
        """
        Set the offsets for the barb polygons.  This saves the offsets passed
        in and masks them as appropriate for the existing U/V data.

        Parameters
        ----------
        xy : sequence of pairs of floats
        """
        self.x = xy[:, 0]
        self.y = xy[:, 1]
        x, y, u, v = cbook.delete_masked_points(
            self.x.ravel(), self.y.ravel(), self.u, self.v)
        _check_consistent_shapes(x, y, u, v)
        xy = np.column_stack((x, y))
        mcollections.PolyCollection.set_offsets(self, xy)
        self.stale = True 
开发者ID:boris-kz,项目名称:CogAlg,代码行数:19,代码来源:quiver.py

示例3: set_UVC

# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import delete_masked_points [as 别名]
def set_UVC(self, U, V, C=None):
        self.u = ma.masked_invalid(U, copy=False).ravel()
        self.v = ma.masked_invalid(V, copy=False).ravel()
        if C is not None:
            c = ma.masked_invalid(C, copy=False).ravel()
            x, y, u, v, c = delete_masked_points(self.x.ravel(),
                                                 self.y.ravel(),
                                                 self.u, self.v, c)
        else:
            x, y, u, v = delete_masked_points(self.x.ravel(), self.y.ravel(),
                                              self.u, self.v)

        magnitude = np.hypot(u, v)
        flags, barbs, halves, empty = self._find_tails(magnitude,
                                                       self.rounding,
                                                       **self.barb_increments)

        # Get the vertices for each of the barbs

        plot_barbs = self._make_barbs(u, v, flags, barbs, halves, empty,
                                      self._length, self._pivot, self.sizes,
                                      self.fill_empty, self.flip)
        self.set_verts(plot_barbs)

        # Set the color array
        if C is not None:
            self.set_array(c)

        # Update the offsets in case the masked data changed
        xy = np.hstack((x[:, np.newaxis], y[:, np.newaxis]))
        self._offsets = xy 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:33,代码来源:quiver.py

示例4: set_offsets

# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import delete_masked_points [as 别名]
def set_offsets(self, xy):
        """
        Set the offsets for the barb polygons.  This saves the offets passed in
        and actually sets version masked as appropriate for the existing U/V
        data. *offsets* should be a sequence.

        ACCEPTS: sequence of pairs of floats
        """
        self.x = xy[:, 0]
        self.y = xy[:, 1]
        x, y, u, v = delete_masked_points(self.x.ravel(), self.y.ravel(),
                                          self.u, self.v)
        xy = np.hstack((x[:, np.newaxis], y[:, np.newaxis]))
        collections.PolyCollection.set_offsets(self, xy) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:16,代码来源:quiver.py

示例5: test_bad_first_arg

# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import delete_masked_points [as 别名]
def test_bad_first_arg(self):
        dmp('a string', self.arr0) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:4,代码来源:test_cbook.py

示例6: test_string_seq

# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import delete_masked_points [as 别名]
def test_string_seq(self):
        actual = dmp(self.arr_s, self.arr1)
        ind = [0, 1, 2, 5]
        expected = (self.arr_s2.take(ind), self.arr2.take(ind))
        assert_array_equal(actual[0], expected[0])
        assert_array_equal(actual[1], expected[1]) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:8,代码来源:test_cbook.py

示例7: test_datetime

# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import delete_masked_points [as 别名]
def test_datetime(self):
        actual = dmp(self.arr_dt, self.arr3)
        ind = [0, 1,  5]
        expected = (self.arr_dt2.take(ind),
                    self.arr3.take(ind).compressed())
        assert_array_equal(actual[0], expected[0])
        assert_array_equal(actual[1], expected[1]) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:9,代码来源:test_cbook.py

示例8: test_rgba

# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import delete_masked_points [as 别名]
def test_rgba(self):
        actual = dmp(self.arr3, self.arr_rgba)
        ind = [0, 1, 5]
        expected = (self.arr3.take(ind).compressed(),
                    self.arr_rgba.take(ind, axis=0))
        assert_array_equal(actual[0], expected[0])
        assert_array_equal(actual[1], expected[1]) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:9,代码来源:test_cbook.py

示例9: set_UVC

# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import delete_masked_points [as 别名]
def set_UVC(self, U, V, C=None):
        self.u = ma.masked_invalid(U, copy=False).ravel()
        self.v = ma.masked_invalid(V, copy=False).ravel()
        if C is not None:
            c = ma.masked_invalid(C, copy=False).ravel()
            x, y, u, v, c = delete_masked_points(self.x.ravel(),
                                                 self.y.ravel(),
                                                 self.u, self.v, c)
            _check_consistent_shapes(x, y, u, v, c)
        else:
            x, y, u, v = delete_masked_points(self.x.ravel(), self.y.ravel(),
                                              self.u, self.v)
            _check_consistent_shapes(x, y, u, v)

        magnitude = np.hypot(u, v)
        flags, barbs, halves, empty = self._find_tails(magnitude,
                                                       self.rounding,
                                                       **self.barb_increments)

        # Get the vertices for each of the barbs

        plot_barbs = self._make_barbs(u, v, flags, barbs, halves, empty,
                                      self._length, self._pivot, self.sizes,
                                      self.fill_empty, self.flip)
        self.set_verts(plot_barbs)

        # Set the color array
        if C is not None:
            self.set_array(c)

        # Update the offsets in case the masked data changed
        xy = np.column_stack((x, y))
        self._offsets = xy
        self.stale = True 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:36,代码来源:quiver.py

示例10: test_bad_first_arg

# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import delete_masked_points [as 别名]
def test_bad_first_arg(self):
        with pytest.raises(ValueError):
            dmp('a string', self.arr0) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:5,代码来源:test_cbook.py

示例11: set_UVC

# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import delete_masked_points [as 别名]
def set_UVC(self, U, V, C=None):
        self.u = ma.masked_invalid(U, copy=False).ravel()
        self.v = ma.masked_invalid(V, copy=False).ravel()
        if C is not None:
            c = ma.masked_invalid(C, copy=False).ravel()
            x, y, u, v, c = delete_masked_points(self.x.ravel(),
                                                 self.y.ravel(),
                                                 self.u, self.v, c)
            _check_consistent_shapes(x, y, u, v, c)
        else:
            x, y, u, v = delete_masked_points(self.x.ravel(), self.y.ravel(),
                                              self.u, self.v)
            _check_consistent_shapes(x, y, u, v)

        magnitude = np.hypot(u, v)
        flags, barbs, halves, empty = self._find_tails(magnitude,
                                                       self.rounding,
                                                       **self.barb_increments)

        # Get the vertices for each of the barbs

        plot_barbs = self._make_barbs(u, v, flags, barbs, halves, empty,
                                      self._length, self._pivot, self.sizes,
                                      self.fill_empty, self.flip)
        self.set_verts(plot_barbs)

        # Set the color array
        if C is not None:
            self.set_array(c)

        # Update the offsets in case the masked data changed
        xy = np.hstack((x[:, np.newaxis], y[:, np.newaxis]))
        self._offsets = xy
        self.stale = True 
开发者ID:alvarobartt,项目名称:twitter-stock-recommendation,代码行数:36,代码来源:quiver.py

示例12: scatter

# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import delete_masked_points [as 别名]
def scatter(self, xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=True,
                *args, **kwargs):
        '''
        Create a scatter plot.

        ============  ========================================================
        Argument      Description
        ============  ========================================================
        *xs*, *ys*    Positions of data points.
        *zs*          Either an array of the same length as *xs* and
                      *ys* or a single value to place all points in
                      the same plane. Default is 0.
        *zdir*        Which direction to use as z ('x', 'y' or 'z')
                      when plotting a 2D set.
        *s*           Size in points^2.  It is a scalar or an array of the
                      same length as *x* and *y*.

        *c*           A color. *c* can be a single color format string, or a
                      sequence of color specifications of length *N*, or a
                      sequence of *N* numbers to be mapped to colors using the
                      *cmap* and *norm* specified via kwargs (see below). Note
                      that *c* should not be a single numeric RGB or RGBA
                      sequence because that is indistinguishable from an array
                      of values to be colormapped.  *c* can be a 2-D array in
                      which the rows are RGB or RGBA, however, including the
                      case of a single row to specify the same color for
                      all points.

        *depthshade*
                      Whether or not to shade the scatter markers to give
                      the appearance of depth. Default is *True*.
        ============  ========================================================

        Keyword arguments are passed on to
        :func:`~matplotlib.axes.Axes.scatter`.

        Returns a :class:`~mpl_toolkits.mplot3d.art3d.Patch3DCollection`
        '''

        had_data = self.has_data()

        xs, ys, zs = np.broadcast_arrays(
            *[np.ravel(np.ma.filled(t, np.nan)) for t in [xs, ys, zs]])
        s = np.ma.ravel(s)  # This doesn't have to match x, y in size.

        xs, ys, zs, s, c = cbook.delete_masked_points(xs, ys, zs, s, c)

        patches = super().scatter(xs, ys, s=s, c=c, *args, **kwargs)
        is_2d = not cbook.iterable(zs)
        zs = np.broadcast_to(zs, len(xs))
        art3d.patch_collection_2d_to_3d(patches, zs=zs, zdir=zdir,
                                        depthshade=depthshade)

        if self._zmargin < 0.05 and xs.size > 0:
            self.set_zmargin(0.05)

        #FIXME: why is this necessary?
        if not is_2d:
            self.auto_scale_xyz(xs, ys, zs, had_data)

        return patches 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:63,代码来源:axes3d.py

示例13: set_UVC

# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import delete_masked_points [as 别名]
def set_UVC(self, U, V, C=None):
        self.u = ma.masked_invalid(U, copy=False).ravel()
        self.v = ma.masked_invalid(V, copy=False).ravel()

        # Flip needs to have the same number of entries as everything else.
        # Use broadcast_to to avoid a bloated array of identical values.
        # (can't rely on actual broadcasting)
        if len(self.flip) == 1:
            flip = np.broadcast_to(self.flip, self.u.shape)
        else:
            flip = self.flip

        if C is not None:
            c = ma.masked_invalid(C, copy=False).ravel()
            x, y, u, v, c, flip = cbook.delete_masked_points(
                self.x.ravel(), self.y.ravel(), self.u, self.v, c,
                flip.ravel())
            _check_consistent_shapes(x, y, u, v, c, flip)
        else:
            x, y, u, v, flip = cbook.delete_masked_points(
                self.x.ravel(), self.y.ravel(), self.u, self.v, flip.ravel())
            _check_consistent_shapes(x, y, u, v, flip)

        magnitude = np.hypot(u, v)
        flags, barbs, halves, empty = self._find_tails(magnitude,
                                                       self.rounding,
                                                       **self.barb_increments)

        # Get the vertices for each of the barbs

        plot_barbs = self._make_barbs(u, v, flags, barbs, halves, empty,
                                      self._length, self._pivot, self.sizes,
                                      self.fill_empty, flip)
        self.set_verts(plot_barbs)

        # Set the color array
        if C is not None:
            self.set_array(c)

        # Update the offsets in case the masked data changed
        xy = np.column_stack((x, y))
        self._offsets = xy
        self.stale = True 
开发者ID:boris-kz,项目名称:CogAlg,代码行数:45,代码来源:quiver.py


注:本文中的matplotlib.cbook.delete_masked_points方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。