我们从Python开源项目中,提取了以下8个代码示例,用于说明如何使用seaborn.xkcd_rgb()。
def plot_profile(lab, element): plt.figure() plt.plot(lab.profiles[element], -lab.x, sns.xkcd_rgb["denim blue"], lw=3, label=element) if element == 'Temperature': plt.title('Temperature profile') plt.xlabel('Temperature, C') elif element == 'pH': plt.title('pH profile') plt.xlabel('pH') else: plt.title('%s concentration' % (element, )) plt.xlabel('Concentration') plt.ylabel('Depth') ax = plt.gca() ax.ticklabel_format(useOffset=False) ax.grid(linestyle='-', linewidth=0.2) plt.legend() plt.tight_layout() return ax
def plot_evaluation_episode_reward(): pylab.clf() sns.set_context("poster") pylab.plot(0, 0) episodes = [0] average_scores = [0] median_scores = [0] for n in xrange(len(csv_evaluation)): params = csv_evaluation[n] episodes.append(params[0]) average_scores.append(params[1]) median_scores.append(params[2]) pylab.plot(episodes, average_scores, sns.xkcd_rgb["windows blue"], lw=2) pylab.xlabel("episodes") pylab.ylabel("average score") pylab.savefig("%s/evaluation_episode_average_reward.png" % args.plot_dir) pylab.clf() pylab.plot(0, 0) pylab.plot(episodes, median_scores, sns.xkcd_rgb["windows blue"], lw=2) pylab.xlabel("episodes") pylab.ylabel("median score") pylab.savefig("%s/evaluation_episode_median_reward.png" % args.plot_dir)
def plot_episode_reward(): pylab.clf() sns.set_context("poster") pylab.plot(0, 0) episodes = [0] scores = [0] for n in xrange(len(csv_episode)): params = csv_episode[n] episodes.append(params[0]) scores.append(params[1]) pylab.plot(episodes, scores, sns.xkcd_rgb["windows blue"], lw=2) pylab.xlabel("episodes") pylab.ylabel("score") pylab.savefig("%s/episode_reward.png" % args.plot_dir)
def plot_training_episode_highscore(): pylab.clf() sns.set_context("poster") pylab.plot(0, 0) episodes = [0] highscore = [0] for n in xrange(len(csv_training_highscore)): params = csv_training_highscore[n] episodes.append(params[0]) highscore.append(params[1]) pylab.plot(episodes, highscore, sns.xkcd_rgb["windows blue"], lw=2) pylab.xlabel("episodes") pylab.ylabel("highscore") pylab.savefig("%s/training_episode_highscore.png" % args.plot_dir)
def plot_crbh_fit(model_df, hits_df, model_plot_fn, show=False, figsize=(10,10), feature_col='E', length_col='s_aln_len', **fig_kwds): plt.style.use('seaborn-ticks') with FigureManager(model_plot_fn, show=show, figsize=figsize, **fig_kwds) as (fig, ax): sample_size = min(len(hits_df), 5000) hits_df, scaled_col = scale_evalues(hits_df, name=feature_col, inplace=False) ax.scatter(hits_df[length_col], hits_df[scaled_col], s=10, alpha=0.7, c=sns.xkcd_rgb['ruby'], marker='o', label='Query Hits') ax.scatter(model_df['center'], model_df['fit'], label='CRBL Fit', c=sns.xkcd_rgb['twilight blue'], marker='o', s=5, alpha=0.7) leg = ax.legend(fontsize='medium', scatterpoints=3, frameon=True) leg.get_frame().set_linewidth(1.0) ax.set_xlim(model_df['center'].min(), model_df['center'].max()) ax.set_ylim(0, max(model_df['fit'].max(), hits_df[scaled_col].max()) + 50) ax.set_ylabel('Score ($E_{scaled}$)' if scaled_col == 'E_scaled'\ else 'Score ({0})'.format(scaled_col)) ax.set_xlabel('Alignment Length')