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


Python cm.plasma方法代码示例

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


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

示例1: create_molecular_error_distribution_plots

# 需要导入模块: from matplotlib import cm [as 别名]
# 或者: from matplotlib.cm import plasma [as 别名]
def create_molecular_error_distribution_plots(collection_df, directory_path, file_base_name, subset_of_method_ids):

    # Ridge plot using all predictions
    ridge_plot(df=collection_df, by = "Molecule ID", column = "$\Delta$logP error (calc - exp)", figsize=(4, 6),
                colormap=cm.plasma)
    plt.savefig(directory_path + "/" + file_base_name +"_all_methods.pdf")

    # Ridge plot using only consistently well-performing methods
    collection_subset_df =  collection_df[collection_df["receipt_id"].isin(subset_of_method_ids)].reset_index(drop=True)
    ridge_plot(df=collection_subset_df, by = "Molecule ID", column = "$\Delta$logP error (calc - exp)", figsize=(4, 6),
                colormap=cm.plasma)
    plt.savefig(directory_path + "/" + file_base_name +"_well_performing_methods.pdf") 
开发者ID:samplchallenges,项目名称:SAMPL6,代码行数:14,代码来源:logP_analysis2.py

示例2: create_category_error_distribution_plots

# 需要导入模块: from matplotlib import cm [as 别名]
# 或者: from matplotlib.cm import plasma [as 别名]
def create_category_error_distribution_plots(collection_df, directory_path, file_base_name):

    # Ridge plot using all predictions
    ridge_plot_wo_overlap(df=collection_df, by = "reassigned category", column = "$\Delta$logP error (calc - exp)", figsize=(4, 4),
                colormap=cm.plasma)
    plt.savefig(directory_path + "/" + file_base_name +".pdf") 
开发者ID:samplchallenges,项目名称:SAMPL6,代码行数:8,代码来源:logP_analysis2.py

示例3: create_molecular_error_distribution_plots

# 需要导入模块: from matplotlib import cm [as 别名]
# 或者: from matplotlib.cm import plasma [as 别名]
def create_molecular_error_distribution_plots(collection_df, directory_path, file_base_name):

    # Ridge plot using all predictions
    ridge_plot(df=collection_df, by = "Molecule ID", column = "$\Delta$logP error (calc - exp)", figsize=(4, 6),
                colormap=cm.plasma)
    plt.savefig(directory_path + "/" + file_base_name +"_all_methods.pdf")



# =============================================================================
# MAIN
# ============================================================================= 
开发者ID:samplchallenges,项目名称:SAMPL6,代码行数:14,代码来源:logP_analysis2.py

示例4: visflow

# 需要导入模块: from matplotlib import cm [as 别名]
# 或者: from matplotlib.cm import plasma [as 别名]
def visflow(flow_img):
    # H x W x 2
    flow_img = convert2np(flow_img)
    from matplotlib import cm
    x_img = flow_img[:, :, 0]

    def color_within_01(vals):
        # vals is Nx1 in [-1, 1] (but could be larger)
        vals = np.clip(vals, -1, 1)
        # make [0, 1]
        vals = (vals + 1) / 2.
        # Append dummy end vals for consistent coloring
        weights = np.hstack([vals, np.array([0, 1])])
        # Drop the dummy colors
        colors = cm.plasma(weights)[:-2, :3]
        return colors

    # x_color = cm.plasma(x_img.reshape(-1))[:, :3]
    x_color = color_within_01(x_img.reshape(-1))
    x_color = x_color.reshape([x_img.shape[0], x_img.shape[1], 3])
    y_img = flow_img[:, :, 1]
    # y_color = cm.plasma(y_img.reshape(-1))[:, :3]
    y_color = color_within_01(y_img.reshape(-1))
    y_color = y_color.reshape([y_img.shape[0], y_img.shape[1], 3])
    vis = np.vstack([x_color, y_color])
    # import matplotlib.pyplot as plt
    # plt.ion()
    # plt.imshow(x_color)
    return vis 
开发者ID:akanazawa,项目名称:cmr,代码行数:31,代码来源:bird_vis.py

示例5: process_results

# 需要导入模块: from matplotlib import cm [as 别名]
# 或者: from matplotlib.cm import plasma [as 别名]
def process_results(self):
        """ Sync the results up accoding to the sim time and determine
        which rates are stable and instable in the sim 
        Returns Array or RPYs, Max rate that is stable, color for each RPY point, """
        threshold = 0.001 #1mm
        instable = []
        stable = []

        d_range = self.max_d_sum - self.min_d_sum
        print ("Min=", self.min_d_sum)
        print ("Max=", self.max_d_sum)
        print ("D range=", d_range)


        norm = matplotlib.colors.Normalize(vmin=self.min_d_sum, vmax=self.max_d_sum, clip=True)
        mapper = cm.ScalarMappable(norm=norm, cmap=cm.plasma)

        #print (self.data_pose)
        max_r = 0
        colors = []
        rates = []
        ds = [] #array of distance sums

        for i in range(len(self.data_pose)):

            ac_trial = np.array(self.data_ac[i])
            for pose in self.data_pose[i]:
                t = pose[0]
                d_sum = pose[1]
                found_row = ac_trial[np.where(ac_trial[:,0] == t)]
                if len(found_row) > 0:
                    rate = found_row[0][1:]
                    #print ("t=", t, " d_sum", d_sum)
                    #print (found_row)

                    colors.append(mapper.to_rgba(d_sum))
                    rates.append(rate)
                    ds.append(d_sum)

                    if d_sum >= threshold:
                        instable.append(rate)
                        if (rate < self.min_rate).all():
                            self.min_rate = rate.copy()
                    else:
                        stable.append(rate)
                        r = np.linalg.norm(rate)
                        if r > max_r:
                            max_r = r
            #print ("t=", t, " rpy=", rate)
        #return np.array(instable), np.array(stable), max_r, colors
        print ("Instability occurs at ", self.min_rate)
        np.savetxt("/tmp/unstable.txt", instable )
        return np.array(rates), max_r, colors, ds 
开发者ID:wil3,项目名称:gymfc,代码行数:55,代码来源:check_sim_stability.py

示例6: plot

# 需要导入模块: from matplotlib import cm [as 别名]
# 或者: from matplotlib.cm import plasma [as 别名]
def plot(self):

        #instable, stable, r, colors = self.process_results()
        rates, r, colors, ds = self.process_results()

        #print ("Instable", instable)
        #print ("Stable", stable)

        fig = plt.figure()
        ax = fig.add_subplot(111, projection='3d')

        #stable = ax.scatter(data[:,0], data[:,1], data[:,2], c=colors, label=labels)
        """
        if len(stable)>0:
            ax_stable = ax.scatter(stable[:,0], stable[:,1], stable[:,2], c='b')
        if len(instable)>0:
            ax_instable = ax.scatter(instable[:,0], instable[:,1], instable[:,2], c='r')
        """
        ax_instable = ax.scatter(rates[:,0], rates[:,1], rates[:,2], c=ds, cmap='plasma')

        steps = 20
        theta, phi = np.linspace(0, 2 * np.pi, steps), np.linspace(0, np.pi, steps)
        THETA, PHI = np.meshgrid(theta, phi)
        x = r * np.sin(PHI) * np.cos(THETA)
        y = r * np.sin(PHI) * np.sin(THETA)
        z = r * np.cos(PHI)
        #ax.plot_wireframe(x, y, z, color="b")


        ax.set_xlabel('Roll (deg/s)')
        ax.set_ylabel('Pitch (deg/s)')
        ax.set_zlabel('Yaw (deg/s)')

        """
        if len(instable)>0:
            print ("HERE")
            ax.legend((ax_stable, ax_instable), ("Stable Region", "Instable"))
        else:
            print ("HERE2")
            ax.legend((ax_stable,), ("Stable Region",))
        """
        title_mapping = {
            "dart" : "DART",
            "ode" : "ODE",
            "bullet" : "Bullet",
            "simbody" : "Simbody"
        }
        #plt.title("{} Physics Engine - Step size {}".format(title_mapping[self.physics_type], self.step_size))

        #_data = plt.cm.jet()

        cb = plt.colorbar(ax_instable, ax=ax)

        cb.set_label(label='Model Drift (meters)', weight='bold')
        plt.show() 
开发者ID:wil3,项目名称:gymfc,代码行数:57,代码来源:check_sim_stability.py


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