Python seaborn.xkcd_rgb() Examples

The following are 6 code examples of seaborn.xkcd_rgb(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module seaborn , or try the search function .
Example #1
Source File: experiment.py    From double-dqn with MIT License 6 votes vote down vote up
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) 
Example #2
Source File: RnaseqqcReport.py    From CGATPipelines with MIT License 6 votes vote down vote up
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 
Example #3
Source File: RnaseqqcReport.py    From CGATPipelines with MIT License 6 votes vote down vote up
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')) 
Example #4
Source File: experiment.py    From double-dqn with MIT License 5 votes vote down vote up
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) 
Example #5
Source File: experiment.py    From double-dqn with MIT License 5 votes vote down vote up
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) 
Example #6
Source File: active.py    From chemml with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
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