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


Python Circle.set_clip_box方法代码示例

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


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

示例1: circle

# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_clip_box [as 别名]
def circle(xy=None, x=None, y=None, **kwargs):
	if xy is None:
		if x is None or y is None:
			raise 'circle: need x and y'
		xy = array([x,y])
	c = Circle(xy=xy, **kwargs)
	a=gca()
	c.set_clip_box(a.bbox)
	a.add_artist(c)
	return c
开发者ID:blackball,项目名称:an-test6,代码行数:12,代码来源:plotutils.py

示例2: circle

# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_clip_box [as 别名]
def circle( xy, radius, color="lightsteelblue", facecolor="none", alpha=1, ax=None ):
    """ add a circle to ax= or current axes
    """
        # from .../pylab_examples/ellipse_demo.py
    e = Circle( xy=xy, radius=radius )
    if ax is None:
        ax = plt.gca()  # ax = subplot( 1,1,1 )
    ax.add_artist(e)
    e.set_clip_box(ax.bbox)
    e.set_edgecolor( color )
    e.set_facecolor( facecolor )  # "none" not None
    e.set_alpha( alpha )
开发者ID:otherview,项目名称:wlanlist,代码行数:14,代码来源:trataDados.py

示例3: scatter_plot

# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_clip_box [as 别名]
 def scatter_plot(self, equators=True, tagging=True, depth_cap=None):
     if depth_cap is None:
         depth_cap = self.height
     fig = plt.figure(figsize=(12, 10))
     ax = fig.add_subplot(111, projection="3d")
     plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)
     xs = [self.nodes[self.root].coord.x]
     ys = [self.nodes[self.root].coord.y]
     zs = [self.nodes[self.root].coord.z]
     plot_color_board = ["blue", "red", "yellow", "green", "black"]
     font0 = FontProperties()
     font0.set_size(8)
     current_generation = deque([self.root])
     next_generation = True
     while next_generation:
         next_generation = deque()
         while current_generation:
             n = current_generation.popleft()
             if self.nodes[n].depth <= depth_cap:
                 xs.append(self.nodes[n].coord.x)
                 ys.append(self.nodes[n].coord.y)
                 zs.append(self.nodes[n].coord.z)
                 if tagging:
                     ax.text(self.nodes[n].coord.x + 0.01,
                             self.nodes[n].coord.y + 0.01,
                             self.nodes[n].coord.z + 0.01,
                             ("n{0}".format(n)), fontproperties=font0)
             for child in self.nodes[n].children:
                 next_generation.append(child)
                 if self.nodes[n].depth <= depth_cap:
                     xe = [self.nodes[n].coord.x, self.nodes[child].coord.x]
                     ye = [self.nodes[n].coord.y, self.nodes[child].coord.y]
                     ze = [self.nodes[n].coord.z, self.nodes[child].coord.z]
                     ax.plot(xe, ye, ze, plot_color_board[self.nodes[n].depth % 5])
         current_generation = next_generation
     ax.scatter(xs, ys, zs, c="r", marker="o")
     global_radius = self.nodes[self.root].radius * 1.12
     if equators:
         for axis in ["x", "y", "z"]:
             circle = Circle((0, 0), global_radius * 1.1)
             circle.set_clip_box(ax.bbox)
             circle.set_edgecolor("gray")
             circle.set_alpha(0.3)
             circle.set_facecolor("none")  # "none" not None
             ax.add_patch(circle)
             art3d.pathpatch_2d_to_3d(circle, z=0, zdir=axis)
     ax.set_xlim([-1.2 * global_radius, 1.2 * global_radius])
     ax.set_ylim([-1.2 * global_radius, 1.2 * global_radius])
     ax.set_zlim([-1.2 * global_radius, 1.2 * global_radius])
     ax.set_xlabel("X Label")
     ax.set_ylabel("Y Label")
     ax.set_zlabel("Z Label")
     plt.show()
开发者ID:ee08b397,项目名称:hypy,代码行数:55,代码来源:tree.py

示例4: draw_vswr_circles

# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_clip_box [as 别名]
    def draw_vswr_circles(self, vswr_radii, labels=False):
        for r in vswr_radii:
            c = Circle((0, 0), r, ls='dashed', **self.patch_options_light)

            c.set_clip_path(self.smith_circle)
            c.set_clip_box(self.ax.bbox)
            self.ax.add_patch(c)

        if labels:
            for r in vswr_radii:
                if r > 0:
                    vswr = (1 + r)/(1 - r)
                    self.ax.text(0, r, '%.1f' % vswr, **self.label_options)
开发者ID:fuesika,项目名称:PyTwoPort,代码行数:15,代码来源:smithplot.py

示例5: draw_chart_axes

# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_clip_box [as 别名]
    def draw_chart_axes(self):
        # make outer circle
        self.smith_circle = Circle((0, 0), 1, transform=self.ax.transData, fc='none',
                              **self.patch_options_axis)
        self.ax.add_patch(self.smith_circle)

        # make constant r=1 circle
        z0_circle = Circle((0.5, 0), 0.5, transform=self.ax.transData, fc='none',
                              **self.patch_options_axis)
        z0_circle.set_clip_path(self.smith_circle)
        z0_circle.set_clip_box(self.ax.bbox)
        self.ax.add_patch(z0_circle)

        # make x-axis
        line = Line2D([-1,1],[0,0], **self.patch_options_axis)
        line.set_clip_path(self.smith_circle)
        line.set_clip_box(self.ax.bbox)
        self.ax.add_line(line)
开发者ID:fuesika,项目名称:PyTwoPort,代码行数:20,代码来源:smithplot.py

示例6: draw_impedance_circles

# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_clip_box [as 别名]
    def draw_impedance_circles(self, intercept_x_coords, intercept_angles, labels=False):
        r_circle_coords, x_circle_coords, rs, xs = self._impedance_circle_coords(intercept_x_coords, intercept_angles)

        for center, radius in chain(r_circle_coords, x_circle_coords):
            c = Circle(center, radius, **self.patch_options_dark)

            c.set_clip_path(self.smith_circle)
            c.set_clip_box(self.ax.bbox)
            self.ax.add_patch(c)

        if labels:
            for x, r in zip(intercept_x_coords, rs):
                self.ax.text(x + 0.04, 0.03, '%.0f' % round(self.z0*r), **self.label_options)

            for a, x in zip(intercept_angles, xs):
                r = (a - 90) if x > 0 else (a + 90)
                a = np.radians(a)
                d = 1.04

                self.ax.text(d*cos(a), d*sin(a), '%.0fj' % round(self.z0*x), rotation=r, **self.label_options)
开发者ID:fuesika,项目名称:PyTwoPort,代码行数:22,代码来源:smithplot.py

示例7: draw_admittance_circles

# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_clip_box [as 别名]
    def draw_admittance_circles(self, intercept_x_coords, intercept_angles, labels=False):
        r_circle_coords, x_circle_coords, rs, xs = self._impedance_circle_coords(intercept_x_coords, intercept_angles)

        # admittance circles have same coords as impedance ones, except flipped
        # on the y-axis
        for (x, y), radius in chain(r_circle_coords, x_circle_coords):
            c = Circle((-x, -y), radius, **self.patch_options_light)

            c.set_clip_path(self.smith_circle)
            c.set_clip_box(self.ax.bbox)
            self.ax.add_patch(c)

        if labels:
            for x, r in zip(intercept_x_coords, rs):
                self.ax.text(-x, 0, '%.1f' % (1/(50*r)), **self.label_options)

            for a, x in zip(intercept_angles, xs):
                r = (a - 90) if x < 0 else (a + 90)
                a = np.radians(a)

                self.ax.text(cos(pi - a), sin(pi - a), '%.1f' % (1/(50*x)), rotation=r, **self.label_options)
开发者ID:fuesika,项目名称:PyTwoPort,代码行数:23,代码来源:smithplot.py

示例8: circleFromRMS

# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_clip_box [as 别名]
def circleFromRMS(xy, rad):
	cir = Circle(xy, rad)
	cir.set_clip_box(ax.bbox)
	cir.set_alpha(0.2)
	cir.set_facecolor(tableau20[0])
	return cir
开发者ID:lmc0709,项目名称:filteringprocess,代码行数:8,代码来源:pillarPlot.py

示例9: scatter_plot

# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_clip_box [as 别名]
    def scatter_plot(self, equators=True, tagging=True, depth_cap=None, node_coloring=None):
        """
        Plot the tree with nodes and edges, optionally equators and tagging nodes with node numbers.
        The tree is traversed in a breath-first-search.
        Note:
            - To distinct each generations, a color plate of ["blue", "red", "yellow", "green", "black"]
              is used repeatedly.
            - The X, Y, Z axises have been labelled.
            - When the number of nodes is large and the tree is bushy, it's advised disabling tagging for
              better user experience.

        :param bool equators: whether to draw the 3D equators, default True
        :param bool tagging: whether to tag nodes with node numbers, default True
        :param int depth_cap: a filter for rendering the first N generations, default tree height
        :param dict node_coloring: an optional map from node_id : color, to color individual nodes
        """
        if depth_cap is None:
            depth_cap = self.height
        fig = plt.figure(figsize=(12, 10))
        ax = fig.add_subplot(111, projection="3d")
        plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)
        xs = [self.nodes[self.root.node_id].coord.x]
        ys = [self.nodes[self.root.node_id].coord.y]
        zs = [self.nodes[self.root.node_id].coord.z]
        plot_color_board = ["blue", "red", "yellow", "green", "black"]
        font0 = FontProperties()
        font0.set_size(8)
        current_generation = deque([self.root.node_id])
        next_generation = True
        while next_generation:
            next_generation = deque()
            while current_generation:
                n = current_generation.popleft()
                if self.nodes[n].depth <= depth_cap:
                    xs.append(self.nodes[n].coord.x)
                    ys.append(self.nodes[n].coord.y)
                    zs.append(self.nodes[n].coord.z)
                    if tagging:
                        ax.text(self.nodes[n].coord.x + 0.01,
                                self.nodes[n].coord.y + 0.01,
                                self.nodes[n].coord.z + 0.01,
                                ("n{0}".format(n)), fontproperties=font0)
                for child in self.nodes[n].children:
                    next_generation.append(child.node_id)
                    if self.nodes[n].depth <= depth_cap:
                        xe = [self.nodes[n].coord.x, self.nodes[child.node_id].coord.x]
                        ye = [self.nodes[n].coord.y, self.nodes[child.node_id].coord.y]
                        ze = [self.nodes[n].coord.z, self.nodes[child.node_id].coord.z]
                        if node_coloring:
                            ax.plot(xe, ye, ze, node_coloring.get(n, 'black'))
                        else:
                            ax.plot(xe, ye, ze, plot_color_board[self.nodes[n].depth % 5])
            current_generation = next_generation
        ax.scatter(xs, ys, zs, c="r", marker="o")
        global_radius = self.nodes[self.root.node_id].radius * 1.12
        if equators:
            for axis in ["x", "y", "z"]:
                circle = Circle((0, 0), global_radius * 1.1)
                circle.set_clip_box(ax.bbox)
                circle.set_edgecolor("gray")
                circle.set_alpha(0.3)
                circle.set_facecolor("none")  # "none" not None
                ax.add_patch(circle)
                art3d.pathpatch_2d_to_3d(circle, z=0, zdir=axis)
        ax.set_xlim([-1.2 * global_radius, 1.2 * global_radius])
        ax.set_ylim([-1.2 * global_radius, 1.2 * global_radius])
        ax.set_zlim([-1.2 * global_radius, 1.2 * global_radius])
        ax.set_xlabel("X Label")
        ax.set_ylabel("Y Label")
        ax.set_zlabel("Z Label")
        plt.show()
开发者ID:BritneyMuller,项目名称:pyh3,代码行数:73,代码来源:tree.py


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