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


Python Ellipse.set_edgecolor方法代码示例

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


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

示例1: UVellipse

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_edgecolor [as 别名]
def UVellipse(u,v,w,a,b,v0):
    fig=plt.figure(0)
    
    e1=Ellipse(xy=np.array([0,v0]),width=2*a,height=2*b,angle=0)
    e2=Ellipse(xy=np.array([0,-v0]),width=2*a,height=2*b,angle=0)

    ax=fig.add_subplot(111,aspect="equal")

    ax.plot([0],[v0],"go")
    ax.plot([0],[-v0],"go")
    ax.plot(u[0],v[0],"bo")
    ax.plot(u[-1],v[-1],"bo")

    ax.plot(-u[0],-v[0],"ro")
    ax.plot(-u[-1],-v[-1],"ro")

    ax.add_artist(e1)
    e1.set_lw(1)
    e1.set_ls("--")
    e1.set_facecolor("w")
    e1.set_edgecolor("b")
    e1.set_alpha(0.5)
    ax.add_artist(e2)

    e2.set_lw(1)
    e2.set_ls("--")
    e2.set_facecolor("w")
    e2.set_edgecolor("r")
    e2.set_alpha(0.5)
    ax.plot(u,v,"b")
    ax.plot(-u,-v,"r")
    ax.hold('on')
开发者ID:Ermiasabebe,项目名称:fundamentals_of_interferometry,代码行数:34,代码来源:plotBL.py

示例2: visualizer

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_edgecolor [as 别名]
def visualizer(data, x, y, lengths):
    fig = plt.figure()
    ax = fig.add_subplot(111)
    fig.suptitle("Clustered Results")
    colors = plt.get_cmap("gist_rainbow")
    norm = col.Normalize(vmin = 0, vmax = len(lengths))
    color_map = cm.ScalarMappable(cmap = colors, norm = norm)
    index = 0
    for i in range(len(lengths)):
        plt.scatter(data[index:index + lengths[i], x], data[index:index + lengths[i], y], c = color_map.to_rgba(i))
        if lengths[i] != 1:
            cov = numpy.cov(data[index:index + lengths[i], x], data[index:index + lengths[i], y], ddof = 0)
        else:
            cov = numpy.asarray([[0, 0], [0,0]])
        values, vectors = numpy.linalg.eig(cov)
        angle = numpy.arctan((vectors[0,1] - vectors[1,1])/(vectors[0,0] - vectors[1,0]))
        ellipse = Ellipse(xy = (numpy.mean(data[index:index + lengths[i], x]), numpy.mean(data[index:index + lengths[i], y])), width = 2 * 2 * numpy.sqrt(values[0]),
                          height = 2 * 2 * numpy.sqrt(values[1]), angle = numpy.rad2deg(angle))
        ellipse.set_edgecolor(color_map.to_rgba(i))
        ellipse.set_facecolor("none")
        ax.add_artist(ellipse)
        plt.scatter(numpy.mean(data[index:index + lengths[i], x]), numpy.mean(data[index:index + lengths[i], y]), c = color_map.to_rgba(i), marker = 'x')
        index += lengths[i]
    plt.show()
    plt.close()
开发者ID:STashakkori,项目名称:SongAlbumClassifier,代码行数:27,代码来源:data_operations.py

示例3: draw_ell

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_edgecolor [as 别名]
def draw_ell(cov, xy, color):
    u, v = np.linalg.eigh(cov)
    angle = np.arctan2(v[0][1], v[0][0])
    angle = (180 * angle / np.pi)
    # here we time u2 with 5, assume 95% are in this ellipse
    # I copy this coef from the matlab script~:)
    #there should be a function to calculate it, find it yourself~
    u2 = 5 * (u ** 0.5)
    e = Ellipse(xy, u2[0], u2[1], angle)
    ax.add_artist(e)
    e.set_clip_box(ax.bbox)
    e.set_facecolor('none')
    e.set_edgecolor(color)
开发者ID:105,项目名称:pmtk3,代码行数:15,代码来源:gaussHeightWeight.py

示例4: plot_x_with_mulpart_and_twiss

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_edgecolor [as 别名]
def plot_x_with_mulpart_and_twiss(multipartin, twissin, multipartout, twissout, emittance_x):
    xin = [multipartin[i][0][0] for i in xrange(len(multipartin))]
    xpin = [multipartin[i][0][1] for i in xrange(len(multipartin))]

    beta_x_in = twissin[0]
    alpha_x_in = twissin[1]
    gamma_x_in = twissin[2]

    a = math.sqrt(emittance_x*beta_x_in)
    b = math.sqrt(emittance_x*gamma_x_in)
    phi = 1/2*math.atan(2*alpha_x_in/(gamma_x_in-beta_x_in))

    xo = [multipartout[i][0][0] for i in xrange(len(multipartout))]
    xpo = [multipartout[i][0][1] for i in xrange(len(multipartout))]

    beta_x_out = twissout[0]
    alpha_x_out = twissout[1]
    gamma_x_out = twissout[2]

    a_after = math.sqrt(emittance_x*beta_x_out)
    b_after = math.sqrt(emittance_x*gamma_x_out)
    phi_after = 1/2*math.atan(2*alpha_x_out/(gamma_x_out-beta_x_out))

    ellipse_x = Ellipse((0,0), 2*a, 2*b, -phi*180/constants.pi, linewidth=5)
    ellipse_x.set_facecolor('none')
    ellipse_x.set_edgecolor((0,0,1))

    ellipse_x_after = Ellipse((0,0), 2*a_after, 2*b_after, -phi_after*180/constants.pi, linewidth=5)
    ellipse_x_after.set_facecolor('none')
    ellipse_x_after.set_edgecolor((0,0,1))

    plt.figure(0)

    ax1 = plt.subplot2grid((1,2), (0,0))
    ax1.add_artist(ellipse_x)
    ax1.plot(xin,xpin,'ro', zorder=1)
    plt.title('Initial values in x')
    plt.xlabel('x [m]')
    plt.ylabel('x\' []')

    ax2 = plt.subplot2grid((1,2), (0, 1))
    ax2.add_artist(ellipse_x_after)
    ax2.plot(xo,xpo,'ro', zorder=1)
    #ax2.set_xlim(-0.004, 0.004)
    #ax2.set_ylim(-0.004, 0.004)
    plt.title('Values after all elems in lattice in x')
    plt.xlabel('x [m]')
    plt.ylabel('x\' []')

    plt.show()
开发者ID:OscarES,项目名称:Differential-Algebra-Tracker,代码行数:52,代码来源:plotting.py

示例5: draw_storms

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_edgecolor [as 别名]
def draw_storms(storms, ax=None):
	if ax == None:
		fig = plt.figure()
		ax = fig.add_subplot(111)

	for s in storms:
		ellps = Ellipse(xy=s['centroid'], width=s['majlen'], height=s['minlen'],
					angle=s['angle'])
		ax.add_artist(ellps)
		ellps.set_clip_box(ax.bbox)
		ellps.set_alpha(0.8)
		ellps.set_facecolor('None')
		ellps.set_edgecolor('red')
		ellps.set_linewidth(3)
		plt.draw()
开发者ID:ecgeil,项目名称:radar,代码行数:17,代码来源:trackblobs.py

示例6: covarianceEllipse

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_edgecolor [as 别名]
def covarianceEllipse(mean, covar, scale=1.0):
    eval, evec = np.linalg.eig(covar)
    angles = np.degrees(np.arctan(evec[1,:] / evec[0,:]))
    q1 = np.flatnonzero((angles >= 0) & (angles < 90))[0]
    q2 = 1 - q1
    q1Angle = angles[q1]
    q1Length = np.sqrt(eval[q1])
    q2Length = np.sqrt(eval[q2])
    e = Ellipse(xy=mean, angle=q1Angle,
                width=q1Length*scale, height=q2Length*scale)
    e.set_fill(False)
    e.set_edgecolor("black")
    e.set_alpha(1.0)
    e.set_lw(2)
    e.set_ls("dashed")
    return e
开发者ID:dalexander,项目名称:PRmm,代码行数:18,代码来源:ellipse.py

示例7: add_ellipsoid

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_edgecolor [as 别名]
def add_ellipsoid(
	ax, 
	par, 
	alpha=.75, 
	edge_color=[1.0,.0,1.0], 
	face_color='none', 
	linewidth=2.0,
	plain=False):
	e = Ellipse(xy=(par[0], par[1]), width=par[3], height=par[2], angle=par[4], linewidth=linewidth)
	ax.add_artist(e)
	if plain:	e.set_clip_on(False)
	else: 		e.set_clip_box(ax.bbox)
	if N.array(edge_color).all() == 1.: edge_color = [.5, .5, .5]
	e.set_edgecolor(edge_color)
	e.set_facecolor(face_color)
	e.set_alpha(alpha)
开发者ID:dpc2,项目名称:rgb-autoenc,代码行数:18,代码来源:plots.py

示例8: plot_aperture

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_edgecolor [as 别名]
	def plot_aperture(self,scale=3.0):
		from matplotlib import pyplot as plt
		from matplotlib.patches import Ellipse
		import matplotlib.cm as cmap
		prop=self.properties()
		r_slc=self.r[self.obj_slice[0]]
		c_slc=self.c[self.obj_slice[1]]
		nr,nc=len(r_slc),len(c_slc)
		x=prop['X_Cen']-1.0
		y=prop['Y_Cen']-1.0
		a=prop['A']
		b=prop['B']
		t=prop['PA']
		x=(x-c_slc[0])/(c_slc[-1]-c_slc[0])*nc
		y=(y-r_slc[0])/(r_slc[-1]-r_slc[0])*nr
		a=a*nc/(c_slc[-1]-c_slc[0])
		b=b*nr/(r_slc[-1]-r_slc[0])
		print('x y a b theta: ',x,y,a,b,t)
		e=Ellipse((x,y),a*scale,b*scale,angle=t)
		e.set_linestyle('solid')
		e.set_edgecolor('r')
		e.set_facecolor('none')
		e1=Ellipse((x,y),a*scale,b*scale,angle=t)
		e1.set_linestyle('solid')
		e1.set_edgecolor('r')
		e1.set_facecolor('none')
		
		data_slc=self.data[self.obj_slice]
		udata_slc=self.udata[self.obj_slice]
		mask_slc=self.mask
		if mask_slc is None:
			mask_slc=False
		if not np.isscalar(mask_slc):
			mask_slc=self.mask[self.obj_slice]

		fig, axes = plt.subplots(nrows=1, ncols=3)
		ax1,ax2,ax3=axes.ravel()
			
		ax1.imshow(udata_slc,vmin=udata_slc.min(),vmax=udata_slc.max(),origin='lower',cmap=cmap.get_cmap('gray_r'))
		ax1.set_title('data uncertainty')
		ax2.imshow((data_slc*(np.logical_not(mask_slc))),vmin=data_slc.min(),vmax=data_slc.max(),origin='lower',cmap=cmap.get_cmap('gray_r'))
		ax2.set_title('masked data')
		ax2.add_artist(e)
		ax3.imshow(data_slc,vmin=data_slc.min(),vmax=data_slc.max(),origin='lower',cmap=cmap.get_cmap('gray_r'))
		ax3.set_title('data with ellipse')
		ax3.add_artist(e1)
		plt.show()
开发者ID:zouhu,项目名称:astrophot,代码行数:49,代码来源:detection.py

示例9: plot_fisher

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_edgecolor [as 别名]
def plot_fisher(F, basetitle, i,j, color, rescale=False):
    
    F_inv = numpy.linalg.inv(F)

    ixgrid = numpy.ix_([j,i],[j,i])

    subM = F_inv[ixgrid]

    print subM
    
    sigma1 = numpy.sqrt(subM[0,0])
    sigma2 = numpy.sqrt(subM[1,1])

    subF = numpy.linalg.inv(subM)
    
    l, v = numpy.linalg.eig(subM)
    l = numpy.sqrt(l)
    
    area = l[0]*l[1]*numpy.pi
    
    print names[j] + ' sd: ' + str(sigma1)
    print names[i] + ' sd: ' + str(sigma2)
    print 'area: ' + str(area)
    print 'fom: ' + str(1.0/area)

    ax = plt.subplot(111)
    ax.set_title(basetitle + ': ' + names[j] + ' vs ' + names[i])
    
    ax.set_xlabel(names[j])
    ax.set_ylabel(names[i])
    
    center_i = centers[params[i]]
    center_j = centers[params[j]]
    
    ell = Ellipse(xy=(center_j,center_i),width=l[0]*2, height=l[1]*2, angle=numpy.rad2deg(-numpy.arccos(v[0,0])))
    ell.set_facecolor('none')
    ell.set_edgecolor(color)
    ax.add_artist(ell)

    if rescale:
        plt.xlim([center_j-numpy.sqrt(subM[0,0])*1.2,center_j+numpy.sqrt(subM[0,0])*1.2])
        plt.ylim([center_i-numpy.sqrt(subM[1,1])*1.2,center_i+numpy.sqrt(subM[1,1])*1.2])
        plt.scatter([center_j],[center_i])
开发者ID:kpatton1,项目名称:simpdf,代码行数:45,代码来源:plot_fisher3_real.py

示例10: plotReachSet

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_edgecolor [as 别名]
 def plotReachSet(self, NUM, figname):
     fig = p.figure()
     ax = fig.add_subplot(111, aspect='equal')
     ax.set_xlim(-0.1, 0.6)
     ax.set_ylim(-0.2, 0.6)
     for trace in self:
         for i in [int(floor(k*len(trace.T)/NUM)) for k in range(NUM)]:
             e = Ellipse((trace.V[i],trace.I[i]), width=trace.d1[i], height=trace.d2[i], angle=trace.theta[i])
             ax.add_artist(e)
             e.set_clip_box(ax.bbox)
             e.set_alpha(1)
             e.set_facecolor(p.rand(3))
     for trace in self:
             e = Ellipse((trace.V[0],trace.I[0]), width=trace.d1[0], height=trace.d2[0], angle=trace.theta[0])
             ax.add_artist(e)
             e.set_clip_box(ax.bbox)
             e.set_alpha(1)
             e.set_facecolor('r')
             e.set_edgecolor('r')
     p.savefig(figname)
开发者ID:maidens,项目名称:Matrix-Measure-Reachability-Project,代码行数:22,代码来源:Figure2.py

示例11: star_plot

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_edgecolor [as 别名]
    def star_plot(self, image_data, objects, mark_color="red"):

        """
        Source plot module.
        @param image_data: data part of the FITS image
        @type image_data: numpy array
        @param objects: Return of the detect_sources
        function with skycoords.
        @type objects: astropy.table
        @param mark_color: Color of the plot marks
        @type mark_color: str
        @returns: boolean
        """

        rcParams['figure.figsize'] = [15., 12.]

        # plot background-subtracted image
        fig, ax = plt.subplots()

        m, s = np.mean(image_data), np.std(image_data)
        ax.imshow(image_data, interpolation='nearest',
                  cmap='gray', vmin=m - s, vmax=m + s, origin='lower')

        # plot an ellipse for each object

        objects = Table(objects)

        for i in range(len(objects)):
            e = Ellipse(xy=(objects['x'][i], objects['y'][i]),
                        width=6 * objects['a'][i],
                        height=6 * objects['b'][i],
                        angle=objects['theta'][i] * 180. / np.pi)

            e.set_facecolor('none')
            e.set_edgecolor(mark_color)
            ax.add_artist(e)

        plt.show()

        return True
开发者ID:yucelkilic,项目名称:astrolib,代码行数:42,代码来源:visuals.py

示例12: plotReachSet_norm2

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_edgecolor [as 别名]
    def plotReachSet_norm2(self, NUM, figname):
        fig = p.figure()
        for j in range(n):

            ax = fig.add_subplot(3,3,j)# , aspect='equal')
            ax.set_xlim(0, 4)
            ax.set_ylim(0, 1)
            for trace in self:
                for i in [int(floor(k*len(trace.T)/NUM)) for k in range(NUM)]:
                    
                    e = Ellipse((trace.x[i][j],trace.y[i][j]), width=trace.d1[i], height=trace.d2[i], angle=trace.theta[i])
                    ax.add_artist(e)
                    e.set_clip_box(ax.bbox)
                    e.set_alpha(1)
                    e.set_facecolor(p.rand(3))
            for trace in self:
                    e = Ellipse((trace.x[0][j],trace.y[0][j]), width=trace.d1[0], height=trace.d2[0], angle=trace.theta[0])
                    ax.add_artist(e)
                    e.set_clip_box(ax.bbox)
                    e.set_alpha(1)
                    e.set_facecolor('r')
                    e.set_edgecolor('r')
        p.savefig(figname)
开发者ID:maidens,项目名称:Matrix-Measure-Reachability-Project,代码行数:25,代码来源:Figure4.py

示例13: makeVCMap

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_edgecolor [as 别名]
def makeVCMap(inputlist):
    "prepare_map_for_data"
    # Create maop canvas
    fig = pl.figure(figsize=(25, 3))
    ax = fig.add_subplot(111, aspect="equal")
    ax.set_xlim(-65, -105)
    ax.set_ylim(-2.5, 2.0)
    ax.xaxis.set_major_locator(MultipleLocator(2))
    ax.xaxis.set_minor_locator(MultipleLocator(0.5))
    ax.yaxis.set_major_locator(MultipleLocator(1))
    ax.yaxis.set_minor_locator(MultipleLocator(0.1))
    plt.figtext(0.89, 0.92, inputlist[0], fontdict=None, ha="right")
    # Mapo the data
    for b in inputlist[1]:
        e = Ellipse(xy=[b[1], b[2]], width=b[3] * 2, height=b[4] * 2, angle=b[9], lw=0.25)
        e.set_clip_box(ax.bbox)
        e.set_alpha(0.80)
        e.set_facecolor(inputlist[2])
        e.set_edgecolor("black")
        ax.add_artist(e)
    # Save image
    pl.savefig(directory + inputlist[3] + ".png", dpi=600, bbox_inches="tight")
    pl.close()
    return directory + inputlist[3] + ".png"
开发者ID:akhilk13,项目名称:MilkMan,代码行数:26,代码来源:makemaps.py

示例14: plt_ell_empty

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_edgecolor [as 别名]
def plt_ell_empty(ra,dec,height,width,PA,ax,colour,colour2,alpha,proj):
	'''Plots an ellipse - either plots on the ax_main which uses a wcs projection
	or on the smaller subplots which don't need transforming'''
	##Position Angle measures angle from direction to NCP towards increasing RA (east)
	##Matplotlib plots the angle from the increasing y-axis toward DECREASING x-axis
	##so have to put in the PA as negative
	if proj==1.0:
		ell = Ellipse([ra,dec],width=width,height=height,angle=-PA,linewidth=1.5)  ##minus???
		ell.set_facecolor('none')
		ell.set_edgecolor(colour2)
		ax.add_artist(ell)
		ell = Ellipse([ra,dec],width=width,height=height,angle=-PA,linewidth=1.5)
		ell.set_facecolor(colour)
		ell.set_alpha(0.3)
		ax.add_artist(ell)
	else:
		ell = Ellipse([ra,dec],width=width,height=height,angle=-PA,transform=proj,linewidth=1.5)  ##minus???
		ell.set_facecolor('none')
		ell.set_edgecolor(colour2)
		ax.add_artist(ell)
		ell = Ellipse([ra,dec],width=width,height=height,angle=-PA,transform=proj,linewidth=1.5)
		ell.set_facecolor(colour)
		ell.set_alpha(0.3)
		ax.add_artist(ell)
开发者ID:BrianC2,项目名称:IDR2_matching,代码行数:26,代码来源:plot_outcomes_lib.py

示例15: Ellipse

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_edgecolor [as 别名]
for x in Xraw:
    e = Ellipse(xy=[x[0], x[1]], width=x[2], height=x[3], angle=x[5])
    e.set_clip_box(ax.bbox)
    e.set_alpha(0.01)
    e.set_facecolor([0.1, 0.1, 0.1])
    # ax.add_artist(e)

# Plot DBSCAN cluster list
iter_mean_store = mean_store.itervalues()

for x in iter_mean_store:
    e = Ellipse(xy=[x[0], x[1]], width=x[2], height=x[3], angle=x[5])
    e.set_clip_box(ax.bbox)
    e.set_alpha(0.50)
    e.set_facecolor('green')
    e.set_edgecolor('black')
    # e.set_lw(3)
    ax.add_artist(e)

# Plot final list
new_iter_mean_store = new_mean_store.itervalues()

for x in new_iter_mean_store:
    e = Ellipse(xy=[x[0], x[1]], width=x[2], height=x[3], angle=x[5])
    e.set_clip_box(ax.bbox)
    e.set_alpha(0.75)
    e.set_facecolor('red')
    e.set_edgecolor('black')
    # e.set_lw(3)
    ax.add_artist(e)
开发者ID:ChrisBeaumont,项目名称:MWPClusters,代码行数:32,代码来源:old_cluster_me.py


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