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


Python patches.Arrow方法代码示例

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


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

示例1: plot_contour

# 需要导入模块: from matplotlib import patches [as 别名]
# 或者: from matplotlib.patches import Arrow [as 别名]
def plot_contour(self, w=0.0):
    """
      Plot contour with poles of Green's function in the self-energy 
      SelfEnergy(w) = G(w+w')W(w')
      with respect to w' = Re(w')+Im(w')
      Poles of G(w+w') are located: w+w'-(E_n-Fermi)+i*eps sign(E_n-Fermi)==0 ==> 
      w'= (E_n-Fermi) - w -i eps sign(E_n-Fermi)
    """
    try :
      import matplotlib.pyplot as plt
      from matplotlib.patches import Arc, Arrow 
    except:
      print('no matplotlib?')
      return

    fig,ax = plt.subplots()
    fe = self.fermi_energy
    ee = self.mo_energy
    iee = 0.5-np.array(ee>fe)
    eew = ee-fe-w
    ax.plot(eew, iee, 'r.', ms=10.0)
    pp = list()
    pp.append(Arc((0,0),4,4,angle=0, linewidth=2, theta1=0, theta2=90, zorder=2, color='b'))
    pp.append(Arc((0,0),4,4,angle=0, linewidth=2, theta1=180, theta2=270, zorder=2, color='b'))
    pp.append(Arrow(0,2,0,-4,width=0.2, color='b', hatch='o'))
    pp.append(Arrow(-2,0,4,0,width=0.2, color='b', hatch='o'))
    for p in pp: ax.add_patch(p)
    ax.set_aspect('equal')
    ax.grid(True, which='both')
    ax.axhline(y=0, color='k')
    ax.axvline(x=0, color='k')
    plt.ylim(-3.0,3.0)
    plt.show() 
开发者ID:pyscf,项目名称:pyscf,代码行数:35,代码来源:mf.py

示例2: figure1_a

# 需要导入模块: from matplotlib import patches [as 别名]
# 或者: from matplotlib.patches import Arrow [as 别名]
def figure1_a(
    image_path, display_mode="y", vmax=300, cut_coords=None, figsize=(20, 20)
):
    import matplotlib.patches as patches

    if cut_coords is None:
        cut_coords = [15]

    disp, ax = plot_artifact(
        image_path,
        display_mode=display_mode,
        vmax=vmax,
        cut_coords=cut_coords,
        figsize=figsize,
    )

    ax.add_patch(
        patches.Arrow(
            0.2,  # x
            0.2,  # y
            0.1,  # dx
            0.6,  # dy
            width=0.25,
            color="tomato",
            transform=ax.transAxes,
        )
    )

    ax.add_patch(
        patches.Arrow(
            0.8,  # x
            0.2,  # y
            -0.1,  # dx
            0.6,  # dy
            width=0.25,
            color="tomato",
            transform=ax.transAxes,
        )
    )
    return disp 
开发者ID:poldracklab,项目名称:mriqc,代码行数:42,代码来源:misc.py

示例3: animate_velocity

# 需要导入模块: from matplotlib import patches [as 别名]
# 或者: from matplotlib.patches import Arrow [as 别名]
def animate_velocity(skel_a, ini_arrow, arrow_size, speed_v, ang_v):
    x_range, y_range = _h_ax_range(skel_a)
    fig = plt.figure(figsize = (15, 8))
    ax = plt.subplot(1,2,1)
    ax_speed = plt.subplot(2,2,2)
    ax_ang_speed = plt.subplot(2,2,4)
    ax.set_xlim(*x_range)
    ax.set_ylim(*y_range)
    
    line, = ax.plot([], [], lw=2)
    head_p, = ax.plot([], [], 'o')
    orient_arrow = patches.Arrow(*ini_arrow[0], *arrow_size[0], fc='k', ec='k')
    
    ax_speed.plot(speed_v)
    ax_ang_speed.plot(ang_v)
    
    speed_p, = ax_speed.plot([], 'o') 
    ang_speed_p, = ax_ang_speed.plot([],  'o') 
    
    # animation function. This is called sequentially
    def _animate(i):
        global orient_arrow
        
        x = skel_a[i, :, 0]
        y = skel_a[i, :, 1]
        line.set_data(x, y)
        head_p.set_data(x[0], y[0])
        if ax.patches:
            ax.patches.remove(orient_arrow) 
        orient_arrow = patches.Arrow(*ini_arrow[i], *arrow_size[i], width=50, fc='k', ec='k')
        ax.add_patch(orient_arrow)
        
        speed_p.set_data(i, speed_v[i])
        ang_speed_p.set_data(i, ang_v[i])
        return (line, head_p, orient_arrow, speed_p, ang_speed_p)
    
    # call the animator. blit=True means only re-draw the parts that have changed.
    anim = animation.FuncAnimation(fig, _animate,
                                   frames=skel_a.shape[0], interval=20, blit=True);
    return anim

#%% 
开发者ID:ver228,项目名称:tierpsy-tracker,代码行数:44,代码来源:velocities.py


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