How to use the seaborn.set_palette 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 neurodata / graspy / notebooks / bpedigo / test_sbm_estimation.py View on Github external
np.linalg.norm(p_hat - dcsbm_P) ** 2
# heatmap(dcsbe.p_mat_, inner_hier_labels=labels)
# heatmap(dcsbm_P, inner_hier_labels=labels)
import seaborn as sns


plt.figure()
sns.scatterplot(
    x=latent[:, 0], y=latent[:, 1], hue=dcsbe.vertex_assignments_, linewidth=0
)

#%%
from graspy.embed import LaplacianSpectralEmbed, AdjacencySpectralEmbed

plt.style.use("seaborn-white")
sns.set_palette("Set1")
plt.figure(figsize=(10, 10))
sns.set_context("talk", font_scale=1.5)
sns.scatterplot(x=latent[:, 0], y=latent[:, 1], hue=labels, linewidth=0)
plt.axis("square")
ase = AdjacencySpectralEmbed(n_components=2)
lse = LaplacianSpectralEmbed(n_components=2, form="R-DAD", regularizer=1)
ase_latent = ase.fit_transform(graph)
lse_latent = lse.fit_transform(graph)

plt.figure(figsize=(10, 10))
sns.scatterplot(x=ase_latent[:, 0], y=ase_latent[:, 1], hue=labels, linewidth=0)
plt.axis("square")

plt.figure(figsize=(10, 10))
sns.scatterplot(x=lse_latent[:, 0], y=lse_latent[:, 1], hue=labels, linewidth=0)
plt.axis("square")
github GeoscienceAustralia / sira / sifra / sifraclasses.py View on Github external
def plot_comp_frag(self, fragility_data, hazard_intensity_vals,
                       fig_output_path='./component_fragilities'):
        """
        Generates fragility plots of given component types, and
        saves them in 
        """
        dsclrs = ["#2ecc71", "#3498db", "#feb24c", "#de2d26"]
        grid_colr = '#B6B6B6'

        sns.set_style('whitegrid')
        sns.set_palette(dsclrs)
        sns.set_context('paper')

        if not os.path.exists(fig_output_path):
            os.makedirs(fig_output_path)

        fragility_df = copy.deepcopy(fragility_data)
        fragility_df = fragility_df.query("damage_state!='DS0 None'")

        ds_list = list(fragility_data.index.levels[1].values)
        if 'DS0 None' in ds_list:
            ds_list.remove('DS0 None')

        frag_fig = plt.figure(figsize=(6.0, 3.2))
        axis = frag_fig.add_subplot(111)
        for dmg_state in ds_list:
            scale = fragility_data.loc[(self.type, dmg_state), 'damage_median']
github mdb52 / Pivot_Table_GUI / Pivot_Tables_Pandas_2014_07_18_GUI_V3_beta.py View on Github external
def setSeabornParams():
	# Talk seems to be best choice for font size
	sb.set_context("talk")

	# use "cubehelix" colormap for printing; hls is used for SB
	# sb.palplot(sb.color_palette("jet", 8))
	sb.set_palette(sb.color_palette("jet", 8))
	sb.set_palette("jet",8)
github EugeneNdiaye / safe_grid_search / bench_safe_logreg_path.py View on Github external
def set_style():
    # This sets reasonable defaults for font size for
    # a figure that will go in a paper
    sns.set_context("paper")
    # Set the font to be serif, rather than sans
    sns.set(font='serif', font_scale=1.5)
    sns.set_palette('muted')
    # Make the background white, and specify the
    # specific font family
    sns.set_style("whitegrid", {
        "font.family": "serif",
        "font.serif": ["Times", "Palatino", "serif"]
    })
github VowpalWabbit / vowpal_wabbit / utl / vw-hyperopt.py View on Github external
def plot_progress(self):
        try:
            sns.set_palette('Set2')
            sns.set_style("darkgrid", {"axes.facecolor": ".95"})
        except:
            pass

        self.logger.debug('plotting...')
        plt.figure(figsize=(15,10))
        plt.subplot(211)
        plt.plot(self.trials.losses(), '.', markersize=12)
        plt.title('Per-Iteration Outer Loss', fontsize=16)
        plt.ylabel('Outer loss function value')
        if self.outer_loss_function in ['logloss']:
            plt.yscale('log')
        xticks = [int(i) for i in np.linspace(plt.xlim()[0], plt.xlim()[1], min(len(self.trials.losses()), 11))]
        plt.xticks(xticks, xticks)
github JGCRI / pygcam / pygcam / chart.py View on Github external
def setupPalette(count, pal=None):
    # See http://xkcd.com/color/rgb/. These were chosen to be different "enough".
    colors = ['grass green', 'canary yellow', 'dirty pink', 'azure', 'tangerine', 'strawberry',
              'yellowish green', 'gold', 'sea blue', 'lavender', 'orange brown', 'turquoise',
              'royal blue', 'cranberry', 'pea green', 'vermillion', 'sandy yellow', 'greyish brown',
              'magenta', 'silver', 'ivory', 'carolina blue', 'very light brown']

    palette = sns.color_palette(palette=pal, n_colors=count) if pal else sns.xkcd_palette(colors)
    sns.set_palette(palette, n_colors=count)
github noaa-oar-arl / MONET / monet / plots / taylordiagram.py View on Github external
http://www-pcmdi.llnl.gov/about/staff/Taylor/CV/Taylor_diagram_primer.htm
"""
from __future__ import division, print_function

from builtins import map, object, zip

import matplotlib.pyplot as PLT
import numpy as NP
import seaborn as sns
from past.utils import old_div

__version__ = "Time-stamp: <2012-02-17 20:59:35 ycopin>"
__author__ = "Yannick Copin "

colors = ['#DA70D6', '#228B22', '#FA8072', '#FF1493']
sns.set_palette(sns.color_palette(colors))


class TaylorDiagram(object):
    """Taylor diagram: plot model standard deviation and correlation
    to reference (data) sample in a single-quadrant polar plot, with
    r=stddev and theta=arccos(correlation).
    """

    def __init__(self, refstd, scale=1.5, fig=None, rect=111, label='_'):
        """Set up Taylor diagram axes, i.e. single quadrant polar
        plot, using mpl_toolkits.axisartist.floating_axes. refstd is
        the reference standard deviation to be compared to.
        """

        from matplotlib.projections import PolarAxes
        import mpl_toolkits.axisartist.floating_axes as FA
github mayataka / autogenu-jupyter / pytools / plotsim.py View on Github external
else:
            self.__dim_control_input = self.__time_series_control_input.shape[1]
        
        # set the layout of the graphs and settings  
        self.__num_plot_variables = self.__dim_state+self.__dim_control_input+1
        self.__num_plot_x = int(np.floor(self.__num_plot_variables/np.sqrt(self.__num_plot_variables)))
        self.__num_plot_y = int(np.ceil(self.__num_plot_variables/self.__num_plot_x))

        # adjust figure size 
        self.__figure_scale = 1
        self.__font_scale = 1
        self.__space_scale = 1

        # set format of seaborn
        sns.set_style("ticks")
        sns.set_palette("deep") 
        sns.set_context("paper")
        sns.mpl.pyplot.rc('mathtext', **{'rm':'serif', 'it':'serif:itelic', 'bf':'serif:bold', 'fontset':'cm'})
        sns.mpl.pyplot.rcParams['xtick.direction'] = 'in'
        sns.mpl.pyplot.rcParams['ytick.direction'] = 'in'
        sns.mpl.pyplot.rcParams['pdf.fonttype'] = 42
        sns.mpl.pyplot.rcParams['ps.fonttype'] = 42

        # set the width of lines and axes
        sns.mpl.pyplot.rcParams['lines.linewidth'] = 1
        sns.mpl.pyplot.rcParams['axes.linewidth'] = 0.5
github schatty / d4pg-pytorch / utils / reward_plot.py View on Github external
import json
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.pyplot import figure
import seaborn as sns
sns.set_style('whitegrid')
colors = ['greyish', 'faded blue', "faded green"]
sns.set_palette(sns.xkcd_palette(colors))


def load_xy(path):
    with open(path, 'rb') as f:
        data = json.load(f)
    data = np.asarray(data)
    return data[:, 1:]


def plot_data(paths, output_path, n_rows=1, n_cols=3, smooth_len=5, lw=3):
    figure(num=0, figsize=(20, 5), dpi=100, facecolor='w', edgecolor='k')
    for i_subplot, env_name in enumerate(paths):
        ax = plt.subplot(n_rows, n_cols, i_subplot + 1)
        plt.title(env_name)

        for model_name in paths[env_name]:
github hpclab / rankeval / rankeval / visualization / effectiveness.py View on Github external
def init_plot_style():
    """
    Initialize plot style for RankEval visualization utilities.
    Returns
    -------

    """
    plt.style.use("seaborn-notebook")
    sns.set_palette("deep")