本文整理匯總了Python中seaborn.xkcd_rgb方法的典型用法代碼示例。如果您正苦於以下問題:Python seaborn.xkcd_rgb方法的具體用法?Python seaborn.xkcd_rgb怎麽用?Python seaborn.xkcd_rgb使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類seaborn
的用法示例。
在下文中一共展示了seaborn.xkcd_rgb方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: plot_evaluation_episode_reward
# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import xkcd_rgb [as 別名]
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)
示例2: getColorBar
# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import xkcd_rgb [as 別名]
def getColorBar(self, data):
# factors are the columns after the total number of samples
factors = data.iloc[:, data.shape[0]:]
unique = set(factors.iloc[:, 0])
# select a random set of colours from the xkcd palette
random.seed(5648546)
xkcd = random.sample(list(seaborn.xkcd_rgb.keys()),
len(unique))
col_dict = dict(list(zip(unique, xkcd)))
cols = []
for i in range(0, len(factors.index)):
cols.append(seaborn.xkcd_rgb[col_dict[factors.iloc[i, 0]]])
return cols, factors, unique, xkcd
示例3: __call__
# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import xkcd_rgb [as 別名]
def __call__(self, data, path):
colorbar, factors, unique, xkcd = self.getColorBar(data)
n_samples = data.shape[0]
data = data.iloc[:, :n_samples]
col_dict = dict(list(zip(unique, xkcd)))
print(data.head())
seaborn.set(font_scale=.5)
ax = seaborn.clustermap(data,
row_colors=colorbar, col_colors=colorbar)
plt.setp(ax.ax_heatmap.yaxis.set_visible(False))
for label in unique:
ax.ax_col_dendrogram.bar(
0, 0, color=seaborn.xkcd_rgb[col_dict[label]],
label=label, linewidth=0)
ax.ax_col_dendrogram.legend(loc="center", ncol=len(unique))
return ResultBlocks(ResultBlock(
'''#$mpl %i$#\n''' % ax.cax.figure.number,
title='ClusterMapPlot'))
示例4: plot_episode_reward
# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import xkcd_rgb [as 別名]
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)
示例5: plot_training_episode_highscore
# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import xkcd_rgb [as 別名]
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)
示例6: _visualize_learning_curve
# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import xkcd_rgb [as 別名]
def _visualize_learning_curve(self):
"""plot #3 : The learning curve of results
"""
import matplotlib
matplotlib.use('Agg')
import seaborn as sns
import matplotlib.pyplot as plt
# data preparation
algorithm = ['EMC'] * 3 * len(self._results)
mae = list(self.results['mae'])
mae += list(self.results['mae'] + self.results['mae_std'])
mae += list(self.results['mae'] - self.results['mae_std'])
size = list(self.results['num_training']) * 3
if len(self._random_results) > 0 :
pad_size = len(self._results) - len(self._random_results)
algorithm += ['Random'] * 3 * len(self._results)
mae += list(self.random_results['mae'])
mae += list(self.random_results['mae'] + self.random_results['mae_std']) + [0] * pad_size
mae += list(self.random_results['mae'] - self.random_results['mae_std']) + [0] * pad_size
size += list(self.results['num_training']) * 3
# dataframe
dp = pd.DataFrame()
dp['Algorithm'] = algorithm
dp['Mean Absolute Error'] = mae
dp['Training Size'] = size
# figures
sns.set_style('whitegrid')
fig = plt.figure()
ax = sns.lineplot(x='Training Size',
y='Mean Absolute Error',
style='Algorithm',
hue='Algorithm',
markers={'EMC': 'o', 'Random': 's'},
palette={'EMC': sns.xkcd_rgb["denim blue"],
'Random': sns.xkcd_rgb["pale red"]},
data=dp,
)
# font size
for item in ([ax.title, ax.xaxis.label, ax.yaxis.label] +
ax.get_xticklabels() + ax.get_yticklabels()):
item.set_fontsize(14)
return fig