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


Python Circle.set_alpha方法代码示例

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


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

示例1: circle

# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_alpha [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

示例2: scatter_plot

# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_alpha [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

示例3: circleFromRMS

# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_alpha [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

示例4: Shapely

# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_alpha [as 别名]
matplotlib.rcParams['lines.linewidth'] = 2


pyplot.axis([0, gridWidth, 0, gridHeight])
pyplot.grid(True)
# Setting the axis labels.
pyplot.xlabel('X Space')
pyplot.ylabel('Y Space')

#Give the plot a title
pyplot.title('Radius Search Plot Using Shapely (%d Points)' % (numberOfPoints)) 

# Draw the collision circle/boundary
cir = Circle((circleX, circleY), radius=circleRadius, fc='b')
cir.set_alpha(0.4)
pyplot.gca().add_patch(cir)


for idx, point in enumerate(pointList):
	style = 'go'
	iAlpha = 0.4
	if(idx in matchingPoints):
		style = 'ro'
		iAlpha = 1
	pyplot.plot(point[0], point[1], style, linewidth=1, markersize=3, alpha=iAlpha)


pyplot.savefig(os.getcwd()+'/'+str(filename))

开发者ID:bendemott,项目名称:Python-Shapely-Examples,代码行数:30,代码来源:shapelyAreaSearch.py

示例5: gen_png

# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_alpha [as 别名]
def gen_png(*args):
    if len(args) == 1:
        if len(args[0]) == 4:
            res = args[0][0]
            f_name = args[0][1]
            extension = args[0][2]
            header_lines = args[0][3]
    elif len(args) == 4:
        res = args[0]
        f_name = args[1]
        extension = args[2]
        header_lines = args[3]
    else:
        print "Wrong number or type of arguments, aborting"
        return (-1)

    data = np.loadtxt(f_name+extension, skiprows=header_lines)
    header = np.genfromtxt(f_name+extension, max_rows=4)

    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')

    global t
    t += header[-1]
    dt = header[-1]
    to_delete = []
    for i in range(0, data.shape[0]):
        if (data[i,1] < 0 and data[i,0] >0):
            to_delete.append(i)
    data = np.delete(data, to_delete, axis=0)

    rho = data[::res,-2]
    norm_rho = np.zeros(rho.shape)
    # print np.amin(rho), np.amax(rho)
    for i in range(0, np.shape(rho)[0]):
        norm_rho[i] = (rho[i]-np.amin(rho))/(np.amax(rho)-np.amin(rho))
    # print np.amin(rho), np.amax(rho), rho
    # print np.amin(norm_rho), np.amax(norm_rho), norm_rho
    norm = LogNorm(vmin=np.amin(rho), vmax=np.amax(rho), clip=False)

    radius = np.amax(data[::res,2])
    circle1 = Circle((0,0), radius)
    circle1.set_fill(True)
    circle1.set_edgecolor('red')
    circle1.set_fc('grey')
    circle1.set_alpha(0.5)
    ax.add_patch(circle1)
    art3d.pathpatch_2d_to_3d(circle1, z=0, zdir="y")

    s = ax.scatter(data[::res,0], data[::res,1], data[::res,2], norm=norm, cmap='hot', c=rho, marker='.')
    ax.text2D(0.05, 0.95, '{} myr; {} myr'.format(t,dt), transform=ax.transAxes)
    ax.set_ylim(ax.get_xlim())
    ax.set_xlabel('x')
    ax.set_ylabel('y')
    ax.set_zlabel('z')
    fig.colorbar(s, shrink=0.5, aspect=5)

    # circle2 = Circle((0,0), radius)
    # circle2.set_fill(False)
    # circle2.set_edgecolor('red')
    # ax.add_patch(circle2)
    # art3d.pathpatch_2d_to_3d(circle2, z=0, zdir="x")

    plt.savefig(f_name+'.png', dpi=300, papertype='a4')
    #plt.show()
    plt.close(fig)
    return (f_name, 0)
开发者ID:Thalos12,项目名称:astro_utils,代码行数:69,代码来源:old_generate_png_parallel.py

示例6: Circle

# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_alpha [as 别名]
    circle = Circle((0, 0), 1.0, facecolor=col, edgecolor="k", alpha=1.0)
    ax.add_patch(circle)
    ax.set_frame_on(False)
    ax.set_xticks([])
    ax.set_yticks([])

    plt.draw()
    ax.set_xlim([-1.2, 1.2])
    ax.set_ylim([-1.2, 1.2])

    marble_png = print_figure(fig, "png")
    marble_png64 = encodestring(marble_png).decode("ascii")
    _marble_cache[symb] = '<img src="data:image/png;base64,%s" height="40" width="40">' % marble_png64

    circle.set_alpha(0.25)
    ax.scatter([0, 0], [0, 0], s=55000, marker=r"$\checkmark$", color="green")
    marble_png = print_figure(fig, "png")
    marble_png64 = encodestring(marble_png).decode("ascii")
    _marble_cache[(symb, True)] = '<img src="data:image/png;base64,%s" height="40" width="40">' % marble_png64
    plt.close()


def numbered_marble(col, number):
    if (col, number) not in _marble_cache:
        fig = plt.figure(figsize=(4, 4))
        ax = fig.gca()
        ax.set_xlim([-1.2, 1.2])
        ax.set_ylim([-1.2, 1.2])

        circle = Circle((0, 0), 1.0, facecolor=col, edgecolor="k", alpha=0.7)
开发者ID:ldfaiztt,项目名称:stats-lecture-notes,代码行数:32,代码来源:marbles.py

示例7: Ellipse

# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_alpha [as 别名]
    vx2 = vx / vn
    vy2 = vy / vn
    print Ur1, -vx2, -vy2
    x[i] = x[i - 1] - zeta * vx2
    y[i] = y[i - 1] - zeta * vy2

"""ell = Ellipse((3.0, 4.0), 2, 4, 0)
a = plt.subplot(111, aspect='equal')
ell.set_alpha(0.1)
a.add_artist(ell)"""

c1 = Circle((2.5, 4.25), 2)  # he has a third number. do we need a third number?
c2 = Circle((7.5, 4.5), 1.8)
c3 = Circle((8.5, 8.5), 0.4)

a = plt.subplot(111, aspect="equal")  # assuming 111 makes it grey colored?

c1.set_alpha(0.1)
a.add_artist(c1)
c2.set_alpha(0.1)
a.add_artist(c2)
c3.set_alpha(0.1)
a.add_artist(c3)


plt.plot(x, y, "b.")
plt.xlabel("X")
plt.ylabel("Y")
plt.title("Path")
plt.show()
开发者ID:SDSMT-CSC464-F15,项目名称:landingpad,代码行数:32,代码来源:potential.py

示例8: scatter_plot

# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_alpha [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_alpha方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。