In [5]:
# %load styles.py
import matplotlib.pyplot as plt
%matplotlib inline
%load_ext autoreload
%autoreload 2
from matplotlib.colors import colorConverter
import prettyplotlib as ppl
from matplotlib import rcParams
import seaborn as sns
sns.set(style='ticks', palette='Set1')
sns.despine()
import itertools
# These are the colors. Notice how this is programmed:
# You initialize your colors by
# colorset = palette()
# then you can cycle through the colors:
# color = next(colorset)
# if you want your set to be reset, just create
# a new palette() instance! This way the colors do not interfere.
color_names = ['windows blue', "pale red", "faded green", "amber",
'dark green', 'dark fuchsia', 'browny orange',
'puke green', 'dark royal blue', 'dusty purple',
'red orange','dark grey','blue grey', 'bright purple', 'chocolate brown',
'shit', 'pistachio','stone','asparagus','butter']
colors = sns.xkcd_palette(color_names)
palette = lambda: itertools.cycle(sns.xkcd_palette(color_names) )
fontsize_labels = 26 # size used in latex document
rcParams['text.latex.preamble'] = [r'\usepackage[cmbright]{sfmath}']
rcParams['font.family']= 'sans-serif'
rcParams['font.sans-serif']= 'cmbright'
rcParams['font.weight'] = "light"
rcParams['text.usetex'] = True
rcParams['figure.autolayout'] = True
rcParams['font.size'] = fontsize_labels
rcParams['axes.labelsize'] = fontsize_labels
rcParams['xtick.labelsize'] = fontsize_labels
rcParams['ytick.labelsize'] = fontsize_labels
rcParams['legend.fontsize'] = fontsize_labels
rcParams['legend.markerscale'] = 4
rcParams['axes.titlesize'] = fontsize_labels
rcParams['text.color'] = "0.3"
rcParams['xtick.color'] = "0.3"
rcParams['ytick.color'] = "0.3"
rcParams['axes.labelcolor'] = "0.3"
rcParams['axes.edgecolor'] = "0.8"
rcParams['axes.formatter.limits'] = (-2,3)
xfactor = 2
rcParams['figure.figsize'] = (xfactor*6.2, xfactor*3.83)
fig_dir = "./figures/" # directory of figures
save_fig = True
def savefig(filename):
if save_fig == True:
plt.savefig(fig_dir+filename+".pdf")
def fixticks(ax):
for t in ax.xaxis.get_ticklines(): t.set_color('0.8')
for t in ax.yaxis.get_ticklines(): t.set_color('0.8')
In [52]:
import pandas as pd
import numpy as np
In [28]:
xl = pd.ExcelFile("./report.xlsx")
In [29]:
xl.sheet_names
Out[29]:
In [30]:
data = xl.parse("Series-layout A")
In [31]:
data.head()
Out[31]:
In [73]:
fig, ax = plt.subplots()
fixticks(ax)
ax.xaxis.get_major_formatter().set_powerlimits((0, 6))
top10 = data[1110101][1::]
cc10 = top10.notnull()
top5 = data[1110201][1::]
cc5 = top5.notnull()
top1 = data[1110301][1::]
cc1 = top1.notnull()
top05 = data[1110401][1::]
cc05 = top05.notnull()
top01 = data[1110501][1::]
cc01 = top01.notnull()
top001 = data[1110701][1::]
cc001 = top001.notnull()
ax.plot((data["Unnamed: 1"][1::])[cc10], top10[cc10],".", label = "Top 10\%")
ax.plot((data["Unnamed: 1"][1::])[cc5], top5[cc5],".", label = "Top 5\%")
ax.plot((data["Unnamed: 1"][1::])[cc1], top1[cc1],".", label = "Top 1\%")
ax.legend(loc = (1.02,0))
plt.show()
In [66]:
data
Out[66]:
In [ ]: