當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。