forked from PLEnuM-group/Plenum
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.py
More file actions
46 lines (39 loc) · 996 Bytes
/
Copy pathsettings.py
File metadata and controls
46 lines (39 loc) · 996 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import os
import numpy as np
import scipy as sp
import pickle
import matplotlib.colors as mc
from matplotlib.colors import LogNorm
import colorsys
import seaborn as sns
import warnings
warnings.filterwarnings('ignore')
matplotlib = sns.mpl
plt = matplotlib.pyplot
sns.set(
context="notebook",
style="ticks",
font="serif",
font_scale=1.5,
rc={
'font.family': 'serif',
'axes.grid': True,
'grid.color': "0.9",
'mathtext.fontset': 'cm',
'image.cmap': 'mako',
'savefig.format': 'pdf'
}
)
sns.set_palette("crest", n_colors=4)
def reset_palette(n_colors, pal="crest"):
sns.set_palette(pal, n_colors=n_colors)
def calc_mids(arr):
return (arr[1:] + arr[:-1]) * 0.5
def slightly_change_color(color, amount=0.2):
""" slightly change the color hue"""
try:
c = mc.cnames[color]
except:
c = color
c = colorsys.rgb_to_hls(*mc.to_rgb(c))
return colorsys.hls_to_rgb(c[0]+amount, c[1], c[2])