How to use the seaborn.set_style function in seaborn

To help you get started, we’ve selected a few seaborn examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JGCRI / pygcam / pygcam / mcs / analysis.py View on Github external
def plotHistogram(values, xlabel=None, ylabel=None, title=None, xmin=None, xmax=None,
                  extra=None, extraColor='grey', extraLoc='right',
                  hist=True, showCI=False, showMean=False, showMedian=False,
                  color=None, shade=False, kde=True, show=True, filename=None):

    fig = plt.figure()

    style    = "white"
    colorSet = "Set1"
    sns.set_style(style)
    sns.set_palette(colorSet, desat=0.6)
    red, blue, green, purple = sns.color_palette(colorSet, n_colors=4)

    color = blue if color is None else color
    count = values.count()
    bins  = count // 10 if count > 150 else (count // 5 if count > 50 else (count // 2 if count > 20 else None))
    sns.distplot(values, hist=hist, bins=bins, kde=kde, color=color, kde_kws={'shade': shade})

    #sns.axlabel(xlabel=xlabel, ylabel=ylabel)
    if xlabel:
        plt.xlabel(xlabel) # , size='large')
    if ylabel:
        plt.ylabel(ylabel) # , size='large')

    sns.despine()
github JiaxuanYou / graph-generation / test_code.py View on Github external
mmsb_degree = np.load('figures/mmsb_sparse_degree.npy')
kron_degree = np.load('figures/kron_degree.npy')
ba_degree = np.load('figures/ba_degree.npy')

real_clustering = np.load('figures/real_clustering.npy')
graphrnn_rnn_clustering = np.load('figures/graphrnn_rnn_clustering.npy')
graphrnn_mlp_clustering = np.load('figures/graphrnn_mlp_clustering.npy')
mmsb_clustering = np.load('figures/mmsb_sparse_clustering.npy')
kron_clustering = np.load('figures/kron_clustering.npy')
ba_clustering = np.load('figures/ba_clustering.npy')


plt.switch_backend('agg')

sns.set()
sns.set_style("ticks")
sns.set_context("poster",font_scale=1.4,rc={"lines.linewidth": 3.5})

fig = plt.figure()
plt.ylim(0, 0.1)
plt.xlim(0, 50)
plt.tight_layout()
current_size = fig.get_size_inches()
fig.set_size_inches(current_size[0]*1.5, current_size[1]*1.5)
degree_plot = sns.distplot(real_degree,hist=False,rug=False,norm_hist=True,label='Real')
degree_plot = sns.distplot(ba_degree,hist=False,rug=False,norm_hist=True,label='B-A')
degree_plot = sns.distplot(kron_degree,hist=False,rug=False,norm_hist=True,label='Kronecker')
degree_plot = sns.distplot(mmsb_degree,hist=False,rug=False,norm_hist=True,label='MMSB')
degree_plot = sns.distplot(graphrnn_mlp_degree,hist=False,rug=False,norm_hist=True,label='GraphRNN-S')
degree_plot = sns.distplot(graphrnn_rnn_degree,hist=False,rug=False,norm_hist=True,label='GraphRNN')

degree_plot.set(xlabel='degree', ylabel='probability density')
github serrano-s / attn-tests / figure_making / figure_maker.py View on Github external
print("Prob exactly 2: " + str(prob_exactly_2))
    print("Prob exactly 1: " + str(prob_exactly_1))
    print("Prob never uninterpretable: " + str(prob_exactly_0))




"""attn_perf_overlap_for_model('yahoo')
attn_perf_overlap_for_model('imdb')
attn_perf_overlap_for_model('amazon')
attn_perf_overlap_for_model('yelp')"""


try:
    sns.set(font_scale=1.5)
    sns.set_style("whitegrid")
except:
    pass


def make_2x2_2boxplot_set(list1_of_two_vallists_to_boxplot, list2_of_two_vallists_to_boxplot,
                          list3_of_two_vallists_to_boxplot, list4_of_two_vallists_to_boxplot, list_of_colorlabels,
                          list_of_two_color_tuples, labels_for_4_boxplot_sets):
    pass


def make_4_4boxplot_set(list1_of_four_vallists_to_boxplot, list2_of_four_vallists_to_boxplot,
                        list3_of_four_vallists_to_boxplot, list4_of_four_vallists_to_boxplot, list_of_colorlabels,
                        list_of_four_color_tuples, labels_for_4_boxplot_sets):
    pass
github brentp / combined-pvalues / cpv / manhattan.py View on Github external
from __future__ import print_function

import argparse
import sys
import os
import toolshed as ts
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
from itertools import groupby, cycle
from operator import itemgetter
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
try:
    import seaborn as sns
    sns.set_context("paper")
    sns.set_style("dark", {'axes.linewidth': 1})
except ImportError:
    pass
import numpy as np
from cpv._common import bediter, get_col_num, genomic_control

def chr_cmp(a, b):
    a, b = a[0], b[0]
    a = a.lower().replace("_", ""); b = b.lower().replace("_", "")
    achr = a[3:] if a.startswith("chr") else a
    bchr = b[3:] if b.startswith("chr") else b

    try:
        return cmp(int(achr), int(bchr))
    except ValueError:
        if achr.isdigit() and not bchr.isdigit(): return -1
        if bchr.isdigit() and not achr.isdigit(): return 1
github aaronpenne / data_visualization / global_social_survey / sentiment_goopy_blob.py View on Github external
#    
#df_melt = pd.DataFrame(df_dict)


## Add NaN columns to increase viz resolution
for res in range(3):
    df_columns = list(df)
    for i in range(1, 2*len(df_columns)-1, 2):
        df.insert(i, df.columns[i-1],
                  float('nan'),
                  allow_duplicates=True)
    # Interpolate between columns and replace NaNs, [2, NaN, 3] becomes [2, 2.5, 3]
    df = df.interpolate(axis=1)

## Set up plotting and formatting of viz
sns.set_style("white")
font_h1 = {'family': 'monospace',
           'color': 'black',
           'weight': 'semibold',
           'size': 14,
           'horizontalalignment': 'center'}
font_h2 = {'family': 'monospace',
            'color': 'black',
            'weight': 'regular',
            'size': 10,
            'horizontalalignment': 'left'}
font_title = {'family': 'monospace',
              'color': 'black',
              'weight': 'regular',
              'size': 12}

## Create all interpolated data charts, saving images
github simetenn / uncertainpy / uncertainpy / plotting / prettyPlot.py View on Github external
def set_style(sns_style="darkgrid", nr_hues=6, palette=None):
    sns.set_style(sns_style)

    if palette is None:
        sns.set_palette(get_colormap(nr_hues))
    else:
        sns.set_palette(palette)

    set_font()
    set_legend()
    set_figuresize()
github isovic / graphmap / scripts / scatterplot8.py View on Github external
scores_path = '%s/scores-%s' % (results_path, local_scores_id);
		lcs_path = '%s/LCS-%s' % (results_path, local_scores_id);
		lcsl1_path = '%s/LCSL1-%s' % (results_path, local_scores_id);
		l1_path = '%s/double_LCS-%s' % (results_path, local_scores_id);
		# boundedl1_path = '%s/boundedl1-%d' % (results_path, local_scores_id);

		# data_path = lcs_path;
		# print data_path;
		# [x, y] = load_csv(data_path + '.csv');
		# [l_median, threshold_L1_under_max] = FindHoughLine(x, y, error_rate);


		# fig = plt.figure();

		sns.set_style("darkgrid");
		sns.set_style("white")
		# sns.set_style("ticks");
		[fig, ((ax1, ax2), (ax3, ax4))] = plt.subplots(2, 2, sharex=True, sharey=True)

		# plt.clf();

		# fig.subplots_adjust(hspace=-0.5);
		fig.subplots_adjust(wspace=0.1);
		# fig.subplots_adjust(hspace=.5);
		# fig.subplots_adjust(wspace=.5);

		# f, ax = plt.subplots(4, sharex=True, sharey=True)

		# plt.gca().spines['top'].set_visible(False)
		# plt.gca().spines['right'].set_visible(False)
		# plt.gca().get_xaxis().tick_bottom()
		# plt.gca().get_yaxis().tick_left()
github noaa-oar-arl / MONET / monet / util / svobs.py View on Github external
def plot(self, save=True, quiet=True, maxfig=10 ):
        """plot time series of observations"""
        sra = self.obs["siteid"].unique()
        print("PLOT OBSERVATION SITES")
        print(sra)
        sns.set()
        sns.set_style('whitegrid')
        dist = []
        if len(sra) > 20:
            if not quiet:
                print("Too many sites to pop up all plots")
            quiet = True
        for sid in sra:
            ts = get_tseries(self.obs, sid, var="obs", svar="siteid", convert=False)
            ms = get_tseries(self.obs, sid, var="mdl", svar="siteid")
            dist.extend(ts.tolist())
            fig = plt.figure(self.fignum)
            # nickname = nickmapping(sid)
            ax = fig.add_subplot(1, 1, 1)
            # plt.title(str(sid) + '  (' + str(nickname) + ')' )
            plt.title(str(sid))
            ax.set_xlim(self.d1, self.d2)
            ts.plot()
github aleju / gan-error-avoidance / g_lis / sample_density.py View on Github external
import torch.optim as optim
import torchvision
import torchvision.datasets as datasets
import torchvision.transforms as transforms
from torch.autograd import Variable
import os
import os.path
import numpy as np
import imgaug as ia
from scipy import misc
import time
import random
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('whitegrid')

from common import plotting
from common.model import *

def main():
    parser = argparse.ArgumentParser()

    parser.add_argument('--batch_size',         type = int,   default = 256,
        help = 'input batch size')

    parser.add_argument('--image_size',         type = int,   default = -1,
        help = 'image size')

    parser.add_argument('--width',              type = int,   default = -1,
        help = 'image width')