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


Python pylab.contourf方法代码示例

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


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

示例1: plot_wt_layout

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import contourf [as 别名]
def plot_wt_layout(wt_layout, borders=None, depth=None):
    fig = plt.figure(figsize=(6,6), dpi=2000)
    fs = 14
    ax = plt.subplot(111)

    if depth is not None:
        N = 100
        X, Y = plt.meshgrid(plt.linspace(depth[:,0].min(), depth[:,0].max(), N), 
                            plt.linspace(depth[:,1].min(), depth[:,1].max(), N))
        Z = plt.griddata(depth[:,0],depth[:,1],depth[:,2],X,Y, interp='linear')
        plt.contourf(X,Y,Z, label='depth [m]')
        plt.colorbar().set_label('water depth [m]')
    #ax.plot(wt_layout.wt_positions[:,0], wt_layout.wt_positions[:,1], 'or', label='baseline position')
    
    ax.scatter(wt_layout.wt_positions[:,0], wt_layout.wt_positions[:,1], wt_layout._wt_list('rotor_diameter'), label='baseline position')

    if borders is not None:
        ax.plot(borders[:,0], borders[:,1], 'r--', label='border')
        
    ax.set_xlabel('x [m]'); 
    ax.set_ylabel('y [m]')
    ax.axis('equal');
    ax.legend(loc='lower left') 
开发者ID:DTUWindEnergy,项目名称:TOPFARM,代码行数:25,代码来源:plot.py

示例2: contour_pressure

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import contourf [as 别名]
def contour_pressure(self):
        """

        Returns:

        """
        try:
            import pylab as plt
        except ImportError:
            import matplotlib.pyplot as plt
        x, y = self.meshgrid()
        p_coeff = np.polyfit(self.volumes, self.pressure.T, deg=self._fit_order)
        p_grid = np.array([np.polyval(p_coeff, v) for v in self._volumes]).T
        plt.contourf(x, y, p_grid)
        plt.plot(self.get_minimum_energy_path(), self.temperatures)
        plt.xlabel("Volume [$\AA^3$]")
        plt.ylabel("Temperature [K]") 
开发者ID:pyiron,项目名称:pyiron,代码行数:19,代码来源:thermo_bulk.py

示例3: contour_entropy

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import contourf [as 别名]
def contour_entropy(self):
        """

        Returns:

        """
        try:
            import pylab as plt
        except ImportError:
            import matplotlib.pyplot as plt
        s_coeff = np.polyfit(self.volumes, self.entropy.T, deg=self._fit_order)
        s_grid = np.array([np.polyval(s_coeff, v) for v in self.volumes]).T
        x, y = self.meshgrid()
        plt.contourf(x, y, s_grid)
        plt.plot(self.get_minimum_energy_path(), self.temperatures)
        plt.xlabel("Volume [$\AA^3$]")
        plt.ylabel("Temperature [K]") 
开发者ID:pyiron,项目名称:pyiron,代码行数:19,代码来源:thermo_bulk.py

示例4: plot_contourf

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import contourf [as 别名]
def plot_contourf(self, ax=None, show_min_erg_path=False):
        """

        Args:
            ax:
            show_min_erg_path:

        Returns:

        """
        try:
            import pylab as plt
        except ImportError:
            import matplotlib.pyplot as plt
        x, y = self.meshgrid()
        if ax is None:
            fig, ax = plt.subplots(1, 1)
        ax.contourf(x, y, self.energies)
        if show_min_erg_path:
            plt.plot(self.get_minimum_energy_path(), self.temperatures, "w--")
        plt.xlabel("Volume [$\AA^3$]")
        plt.ylabel("Temperature [K]")
        return ax 
开发者ID:pyiron,项目名称:pyiron,代码行数:25,代码来源:thermo_bulk.py

示例5: contour_plot

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import contourf [as 别名]
def contour_plot(func):
    rose = func()
    XS, YS = plt.meshgrid(np.linspace(-2, 2, 20), np.linspace(-2,2, 20));
    ZS = np.array([rose(x1=x, x2=y).f_xy for x,y in zip(XS.flatten(),YS.flatten())]).reshape(XS.shape);
    plt.contourf(XS, YS, ZS, 50);
    plt.colorbar() 
开发者ID:DTUWindEnergy,项目名称:TOPFARM,代码行数:8,代码来源:tutorial.py

示例6: pre_plot

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import contourf [as 别名]
def pre_plot(self):

        plt.ion()
        #plt.show()
        ### Plot the water depth
        N = 100
        self.X, self.Y = plt.meshgrid(plt.linspace(self.depth[:,0].min(), self.depth[:,0].max(), N),
                                  plt.linspace(self.depth[:,1].min(), self.depth[:,1].max(), N))
        self.Z = plt.griddata(self.depth[:,0],self.depth[:,1],self.depth[:,2],self.X,self.Y, interp='linear')

        Zin = points_in_poly(self.X,self.Y, self.borders)
        self.Z.mask = Zin.__neg__()
        #Z.mask = False
        #Z.data[Zin.__neg__()] = -20.0

        display(plt.gcf())

    # def refresh(self):
        self.shape_plot.clear()
        self.shape_plot.contourf(self.X, self.Y, self.Z, 10, vmax=self.depth[:,2].max())       #, cmap=self.pal
        self.shape_plot.set_aspect('equal')
        self.shape_plot.autoscale(tight=True)

        Plot = lambda b, *args, **kwargs: self.shape_plot.plot(b[:,0], b[:,1],*args, **kwargs)
        if self.distribution == 'spiral':
            spiral = lambda t_, a_, x_: [a_*t_**(1./x_) * np.cos(t_), a_*t_**(1./x_) * np.sin(t_)]
            spirals = lambda ts_, a_, x_: np.array([spiral(t_, a_, x_) for t_ in ts_])
            for P in self.baseline:
                Plot(P + spirals(plt.linspace(0.,10*np.pi,1000), self.spiral_param, 1.), 'g-', linewidth=0.1)


        self.shape_plot.plot(self.borders[:,0], self.borders[:,1],'k-')
        self.posi = self.shape_plot.plot(self.wt_positions[:,0], self.wt_positions[:,1],'ro')
        self.plotel = self.shape_plot.plot(np.array([self.baseline[[i,j],0] for i, j in self.elnet_layout.keys()]).T,
                                           np.array([self.baseline[[i,j],1]  for i, j in self.elnet_layout.keys()]).T, 'y--', linewidth=1)
        #print self.plotel

        self.objf_plot.clear()
        targarr = np.array(self.targvalue)
        self.posb = []
        for i in range(targarr.shape[1]):
            self.posb.append(self.objf_plot.plot(self.iterations, self.targvalue[0][i],'.', label=self.targname[i]))
        print 'posb', self.posb
        self.legend = self.objf_plot.legend(loc=3,  bbox_to_anchor=(1.1, 0.0))

        plt.title('Foundation = %8.2f'%(self.foundation_length))
        plt.draw() 
开发者ID:DTUWindEnergy,项目名称:TOPFARM,代码行数:49,代码来源:plot.py


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