當前位置: 首頁>>代碼示例>>Python>>正文


Python Circle.set_fill方法代碼示例

本文整理匯總了Python中matplotlib.patches.Circle.set_fill方法的典型用法代碼示例。如果您正苦於以下問題:Python Circle.set_fill方法的具體用法?Python Circle.set_fill怎麽用?Python Circle.set_fill使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在matplotlib.patches.Circle的用法示例。


在下文中一共展示了Circle.set_fill方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: add_breadcrumb

# 需要導入模塊: from matplotlib.patches import Circle [as 別名]
# 或者: from matplotlib.patches.Circle import set_fill [as 別名]
 def add_breadcrumb(self):
     """ Adds a breadcrumb """
     c = Circle(self._loc, radius = 16.25)
     c.set_facecolor('0.65')  # grey
     c.set_edgecolor('black')
     c.set_zorder(zorders['breadcrumbs'])
     c.set_fill(True)
     self.view.add_artist(c)
     self.breadcrumbs.append(c)
     self.draw()
開發者ID:dwtj,項目名稱:mars-rover,代碼行數:12,代碼來源:rover.py

示例2: add_danger

# 需要導入模塊: from matplotlib.patches import Circle [as 別名]
# 或者: from matplotlib.patches.Circle import set_fill [as 別名]
    def add_danger(self, danger_id):
        """ Appends a new danger to the appropriate list of `env`, and updates
        the `env` view. The position at which the danger is placed is computed
        based on the rover's location and direction, but also where on the
        robot that particular danger-detection sensor is located. """
        
        """if danger_id == left_bumper:
            
        elif danger_id == right_bumper:
            
        elif danger_id == left_and_right_bumper:

        elif danger_id == front_left_cliff:

        elif danger_id == front_right_cliff:

        elif danger_id == left_cliff:

        elif danger_id == right_cliff:

        elif danger_id == white_tape_front_left:

        elif danger_id == white_tape_front_right:

        elif danger_id == white_tape_left:

        elif danger_id == white_tape_right:

        elif danger_id == left_wheel:

        elif danger_id == right_wheel:

        elif danger_id == middle_wheel:

        else:
            raise NotImplementedError()
        """


        # Find the danger location using `danger_angle` and `danger_distance`
        # TODO: maybe later
        # danger_loc = conv_radial(self, danger_theta, danger_r)

        # Plot
        if (1 <= danger_id <= 3): # Bumper range in OIStopID
            """ Adds a bump """
            c = Circle(self._loc, radius = 6.25)
            c.set_facecolor('0.65')  # grey
            c.set_edgecolor('black')
            c.set_zorder(zorders['bumps'])
            c.set_fill(True)
            self.view.add_artist(c)
            self.bumps.append(c)
            self.draw()
        elif (4 <= danger_id <= 7): # Cliff range in OIStopID
            """ Adds a cliff """
            c = Circle(self._loc, radius = 6.25)
            c.set_facecolor('0.65')  # grey
            c.set_edgecolor('black')
            c.set_zorder(zorders['cliffs'])
            c.set_fill(True)
            self.view.add_artist(c)
            self.cliffs.append(c)
            self.draw()
        elif (12 <= danger_id <= 14): # Drop range in OIStopID
            """ Adds a drop """
            c = Circle(self._loc, radius = 6.25)
            c.set_facecolor('0.65')  # grey
            c.set_edgecolor('black')
            c.set_zorder(zorders['drops'])
            c.set_fill(True)
            self.view.add_artist(c)
            self.drops.append(c)
            self.draw()
        elif (8 <= danger_id <= 11): # White tape range in OIStopID
            """ Adds tape """
            c = Circle(self._loc, radius = 6.25)
            c.set_facecolor('0.65')  # grey
            c.set_edgecolor('black')
            c.set_zorder(zorders['tape'])
            c.set_fill(True)
            self.view.add_artist(c)
            self.tape.append(c)
            self.draw()
        else:
            raise NotImplementedError()
            
        # The following is the temporary workaround:
        sys.stderr.write("danger found: " + str(danger_id)) # TODO: check to see if enum strig is a thing
開發者ID:dwtj,項目名稱:mars-rover,代碼行數:91,代碼來源:rover.py

示例3: gen_png

# 需要導入模塊: from matplotlib.patches import Circle [as 別名]
# 或者: from matplotlib.patches.Circle import set_fill [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


注:本文中的matplotlib.patches.Circle.set_fill方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。