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


Python Ellipse.set_alpha方法代码示例

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


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

示例1: graficaGrilla

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_alpha [as 别名]
def graficaGrilla(dataGrilla,name,framesNumber,colour,xPixels,yPixels):	
	from matplotlib.patches import Ellipse
	from pylab import figure, show, savefig

	fig = figure()
	ax = fig.add_subplot(111, aspect='equal')
	# Each row of dataGrilla contains 
	# N == "framesNumbers" , signal
	# A radius of the RF ellipse
	# B radius of the RF ellipse
	# Angle of the RF ellipse
	# X coordinate of the RF ellipse
	# Y coordinate of the RF ellipse

	ax = fig.add_subplot(111, aspect='equal')
	for unit in range(dataGrilla.shape[0]):
		eWidth = dataGrilla[unit][framesNumber-1+1]
		eHeight = dataGrilla[unit][framesNumber-1+2]
		eAngle = dataGrilla[unit][framesNumber-1+3]
		eXY = [dataGrilla[unit][framesNumber-1+4],  dataGrilla[unit][framesNumber-1+5]]
		e = Ellipse(xy=eXY, width=eWidth, height=eHeight, angle=eAngle)
		ax.add_artist(e)
		e.set_alpha(0.2)
		e.set_facecolor(colour)
	
	ax.set_xlim(0, xPixels)
	ax.set_ylim(0, yPixels)
	savefig(name, dpi=None, bbox_inches='tight')
	return 0
开发者ID:mjescobar,项目名称:RF_Estimation,代码行数:31,代码来源:rfestimationLib.py

示例2: calculate_ellipse

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_alpha [as 别名]
    def calculate_ellipse(center_x, center_y, covariance_matrix, n_std_dev=3):
        values, vectors = np.linalg.eigh(covariance_matrix)
        order = values.argsort()[::-1]
        values = values[order]
        vectors = vectors[:, order]

        theta = np.degrees(np.arctan2(*vectors[:, 0][::-1]))

        # make all angles positive
        if theta < 0:
            theta += 360

        # Width and height are "full" widths, not radius
        width, height = 2 * n_std_dev * np.sqrt(values)

        ellipse = Ellipse(
            xy=[center_x, center_y],
            width=width,
            height=height,
            angle=theta
        )

        ellipse.set_alpha(0.3)
        ellipse.set_facecolor((1, 0, 0))

        return ellipse
开发者ID:whitews,项目名称:FlowStats,代码行数:28,代码来源:test_hdp.py

示例3: scatter

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_alpha [as 别名]
def scatter(title="title", xlab="x", ylab="y", data=None):
    if data == None:
        r = random.random
        data = [(r() * 10, r() * 10, r(), r(), r(), r(), r()) for i in range(100)]
    figure = Figure()
    figure.set_facecolor("white")
    axes = figure.add_subplot(111)
    if title:
        axes.set_title(title)
    if xlab:
        axes.set_xlabel(xlab)
    if ylab:
        axes.set_ylabel(ylab)
    for i, p in enumerate(data):
        p = list(p)
        while len(p) < 4:
            p.append(0.01)
        e = Ellipse(xy=p[:2], width=p[2], height=p[3])
        axes.add_artist(e)
        e.set_clip_box(axes.bbox)
        e.set_alpha(0.5)
        if len(p) == 7:
            e.set_facecolor(p[4:])
        data[i] = p
    axes.set_xlim(min(p[0] - p[2] for p in data), max(p[0] + p[2] for p in data))
    axes.set_ylim(min(p[1] - p[3] for p in data), max(p[1] + p[3] for p in data))
    canvas = FigureCanvas(figure)
    stream = cStringIO.StringIO()
    canvas.print_png(stream)
    return stream.getvalue()
开发者ID:ykanggit,项目名称:web2py-appliances,代码行数:32,代码来源:plugin_matplotlib.py

示例4: motorplot_group_scatter

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_alpha [as 别名]
def motorplot_group_scatter(fig, ax, data, hz, title, markersz = 2, ellipseht=0.2, ylim=[]):
  for d in data:
    x = d.get('i')
    y = d.get('hz')
    label = d.get('label')
    ax.scatter(x, y, marker='o', s=markersz, label=label)

  xi = ax.get_xlim()[0]
  xf = ax.get_xlim()[1]
  e = Ellipse(((xi + xf)/2,hz),xf-xi, ellipseht)
  e.set_alpha(0.2)
  ax.add_artist(e)
  ax.set_title(title)
  ax.set_xlabel('Sample')
  ax.set_ylabel('Frequency (Hz)')

  box = ax.get_position()
  ax.set_position([box.x0, box.y0, box.width * 0.8, box.height])
  plt.legend(loc='center left', bbox_to_anchor=(1, 0.5), fontsize='large', markerscale=2)

  ax.title.set_fontsize(16)
  ax.xaxis.label.set_fontsize(16)
  for item in ax.get_xticklabels():
    item.set_fontsize(12)
  ax.yaxis.label.set_fontsize(16)
  for item in ax.get_yticklabels():
    item.set_fontsize(12)
  #ax.yaxis.get_major_formatter().set_powerlimits((0, 1))
  if ylim:
    ax.set_ylim(ylim)
开发者ID:PositronicsLab,项目名称:wild-robot,代码行数:32,代码来源:wbplot.py

示例5: PlotLens

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_alpha [as 别名]
 def PlotLens(self,CenterXY, thickness, LensHeight, rotation, alpha=0.5):
     # Definition to plot a lens.
     lens = Ellipse(xy=CenterXY, width=thickness, height=LensHeight, angle=-rotation)
     self.ax.add_artist(lens)
     lens.set_clip_box(self.ax.bbox)
     lens.set_alpha(alpha)
     return True
开发者ID:kunguz,项目名称:odak,代码行数:9,代码来源:odak.py

示例6: motorplot_scatter

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_alpha [as 别名]
def motorplot_scatter(fig, ax, session, hz, title, markersz = 2, ylim=[], color='r'):
  x = session.get('i')
  y = session.get('hz')
  label = session.get('label')
  #title = 'Actuator Frequency - ' + label 
  ax.scatter(x, y, marker='o', s=markersz, label=label, color=color)
  xi = ax.get_xlim()[0]
  xf = ax.get_xlim()[1]
  e = Ellipse(((xi + xf)/2,hz),xf-xi, 0.1)
  e.set_alpha(0.2)
  ax.add_artist(e)
  ax.set_title(title)
  ax.set_xlabel('Sample')
  ax.set_ylabel('Frequency (Hz)')

  ax.title.set_fontsize(16)
  ax.xaxis.label.set_fontsize(16)
  for item in ax.get_xticklabels():
    item.set_fontsize(12)
  ax.yaxis.label.set_fontsize(16)
  for item in ax.get_yticklabels():
    item.set_fontsize(12)
  #ax.yaxis.get_major_formatter().set_powerlimits((0, 1))
  if ylim:
    ax.set_ylim(ylim)
开发者ID:PositronicsLab,项目名称:wild-robot,代码行数:27,代码来源:wbplot.py

示例7: UVellipse

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

示例8: plot_ellipse

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_alpha [as 别名]
def plot_ellipse(x, y, ax, color):
	(xy, width, height, angle) = get_ellipse(x, y)
	e = Ellipse(xy, width, height, angle)
	ax.add_artist(e)
	#e.set_clip_box(ax.bbox)
	e.set_alpha(0.2)
	e.set_facecolor(color)
开发者ID:FHFard,项目名称:scipy2013_talks,代码行数:9,代码来源:plot2d.py

示例9: grad

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_alpha [as 别名]
def grad(im,Ix,Iy,prozor=5):

    #koordinate oko kojih ce se gledati gradijent
    imshow(im)
    koord = ginput(1)
    x = round(koord[0][0])
    y = round(koord[0][1])
    
    #uzmi gradijente Ix i Iy unutar tog prozora
    IxF = (Ix[x-prozor:x+prozor+1,y-prozor:y+prozor+1]).flatten()
    IyF = (Iy[x-prozor:x+prozor+1,y-prozor:y+prozor+1]).flatten()

    #neka kvazi matematika...
    width = abs(max(IxF)) + abs(min(IxF))
    height = abs(max(IyF)) + abs(min(IyF))
    xS = (max(IxF) + min(IxF))/2
    yS = (max(IyF) + min(IyF))/2

    """x_segment = width/15.0
    y_segment = width/15.0
    broj_pojava = zeros((15,15),dtype='int')

    #procjeni gdje je najgusce
    for i in range(15):
        for j in range(15):
            for k in IxF:
                for m in IyF:
                    if IxF[k] >= i*x_segment and IxF[k] <= (i+1)*x_segment:
                        if IyF[m] >= j*y_segment and IyF[m] <= (j+1)*y_segment:
                            broj_pojava[i][j] += 1

    x_pom,y_pom = unravel_index(broj_pojava.argmax(), broj_pojava.shape)

    x = (x_pom*x_segment + (x_pom+1)*x_segment)/2
    y = (y_pom*y_segment + (y_pom+1)*y_segment)/2

    angle = arctan(y*1.0/x*1.0)*180/pi"""
            
    
    
    mod = sqrt(IxF**2 + IyF**2)
    pom = argmax(mod)
    angle = arctan(IyF[pom]*1.0/IxF[pom]*1.0)*180/pi
    if width < max(mod):
        width = max(mod)
    
    ells = Ellipse((xS,yS),width,height,angle)
    ells.set_alpha(0.3)


    
    fig = figure()
    ax = fig.add_subplot(111,aspect='equal')
    ax.add_artist(ells)
    ax.plot(IxF,IyF,'mo') #crtaj histogram
    gray()
    grid('on')
    show()
    return 
开发者ID:gosamer,项目名称:harris-corner-detector-FER,代码行数:61,代码来源:pok.py

示例10: plotCovEllipse

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_alpha [as 别名]
def plotCovEllipse(cov, pos, nstd=2, ax=None, with_line=False, **kwargs):
    """
    Plots an `nstd` sigma error ellipse based on the specified covariance
    matrix (`cov`). Additional keyword arguments are passed on to the
    ellipse patch artist.
    Parameters
    ----------
        cov : The 2x2 covariance matrix to base the ellipse on
        pos : The location of the center of the ellipse. Expects a 2-element
            sequence of [x0, y0].
        nstd : The radius of the ellipse in numbers of standard deviations.
            Defaults to 2 standard deviations.
        ax : The axis that the ellipse will be plotted on. Defaults to the
            current axis.
        Additional keyword arguments are pass on to the ellipse patch.
    Returns
    -------
        A matplotlib ellipse artist
    """

    def eigsorted(cov):
        vals, vecs = np.linalg.eigh(cov)
        order = vals.argsort()[::-1]
        return vals[order], vecs[:, order]

    if ax is None:
        ax = plt.gca()

    # largest eigenvalue is first
    vals, vecs = eigsorted(cov)
    theta = np.degrees(np.arctan2(*vecs[:, 0][::-1]))

    # Width and height are "full" widths, not radius
    width, height = 2 * nstd * np.sqrt(vals)
    ellip = Ellipse(xy=pos, width=width, height=height, angle=theta, **kwargs)

    if 'alpha' not in kwargs.keys():
        ellip.set_alpha(0.3)
    if 'color' not in kwargs.keys():# and 'c' not in kwargs.keys():
        ellip.set_facecolor('red')

    ax.add_patch(ellip)

    # THEN just f***ing plot an invisible line across the ellipse.
    if with_line:
        # brute forcing axes limits so they contain ellipse patch
        # maybe a cleaner way of doing this, but I couldn't work it out
        x_extent = 0.5*(abs(width*np.cos(np.radians(theta))) +
                        abs(height*np.sin(np.radians(theta))))
        y_extent = 0.5*(abs(width*np.sin(np.radians(theta))) +
                        abs(height*np.cos(np.radians(theta))))

        lx = pos[0] - x_extent
        ux = pos[0] + x_extent
        ly = pos[1] - y_extent
        uy = pos[1] + y_extent
        ax.plot((lx, ux), (ly, uy), alpha=0.)

    return ellip
开发者ID:mikeireland,项目名称:chronostar,代码行数:61,代码来源:fitplotter.py

示例11: draw

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_alpha [as 别名]
 def draw(self, axes, figure, color):
     mycirc = Ellipse(self.center, self.width, self.height, facecolor='none', edgecolor=color)
     mycirc.set_linewidth(1)
     mycirc.set_alpha(1)
     mycirc.set_facecolor('none')
     mycirc.set_hatch('//')
     circ = axes.add_artist(mycirc)
     figure.canvas.draw()
     return circ
开发者ID:JoshBradshaw,项目名称:bloodtools,代码行数:11,代码来源:ROI.py

示例12: plot_ellipse

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_alpha [as 别名]
def plot_ellipse(pos, angle, w1, w2, edge_color, face_color='w',
                 alpha=1.):
    orient = math.degrees(angle)
    e = Ellipse(xy=pos, width=w1, height=w2, angle=orient,
                facecolor=face_color, edgecolor=edge_color)
    e.set_alpha(alpha)
    ax = pp.gca()
    ax.add_patch(e)
    return e
开发者ID:gt-ros-pkg,项目名称:hrl-lib,代码行数:11,代码来源:matplotlib_util.py

示例13: draw_ellipse

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_alpha [as 别名]
def draw_ellipse(a, m, S):
    v, w = np.linalg.eigh(S)
    u = w[0] / np.linalg.norm(w[0])
    angle = (180.0 / np.pi) * np.arctan(u[1] / u[0])
    e = Ellipse(m, 2.0 * np.sqrt(v[0]), 2.0 * np.sqrt(v[1]),
                180.0 + angle, color = 'k')
    a.add_artist(e)
    e.set_clip_box(ax.bbox)
    e.set_alpha(0.5)
开发者ID:nfoti,项目名称:StochasticBlockmodel,代码行数:11,代码来源:rasch_normal_bayes.py

示例14: draw_ellipse

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_alpha [as 别名]
 def draw_ellipse(axes, cluster):
     x = 0.5 * (cluster.data[0] + cluster.data[1])
     rng = cluster.data[1] - cluster.data[0]
     y = .25 + (cluster.level - 1) * 1.5 / (max_level - 1) 
     height = 1.5 / (max_level - 1)
     ell = Ellipse(xy=[x,y], width=rng, height=height, angle=0)
     axes.add_artist(ell)
     ell.set_clip_box(axes.bbox)
     ell.set_alpha(0.5)
     ell.set_facecolor([0, 0, 1.0])
开发者ID:TheSumitGogia,项目名称:insight,代码行数:12,代码来源:structs.py

示例15: ellipses

# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_alpha [as 别名]
 def ellipses(self, data, color='blue', width=0.01, height=0.01):
     for point in data:
         x, y = point[:2]
         dx = point[2] if len(point)>2 else width
         dy = point[3] if len(point)>3 else height
         ellipse = Ellipse(xy=(x, y), width=dx, height=dy)
         self.ax.add_artist(ellipse)
         ellipse.set_clip_box(self.ax.bbox)
         ellipse.set_alpha(0.5)
         ellipse.set_facecolor(color)
     return self
开发者ID:ebratt,项目名称:canvas,代码行数:13,代码来源:canvas.py


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