#!/usr/bin/env python
"""
rcparams utilities
"""
import pandas as pd
import matplotlib.pyplot as plt
import sys
__author__ = "Daniel Goldfarb"
__version__ = "0.1.0"
__license__ = "MIT"
def rcParams_to_df(rcp,name=None):
keys = []
vals = []
for item in rcp:
keys.append(item)
vals.append(rcp[item])
df = pd.DataFrame(vals,index=pd.Index(keys,name='rcParamsKey'))
if name is not None:
df.columns = [name]
else:
df.columns = ['Value']
return df
def compare_styles(s1,s2):
with plt.rc_context():
plt.style.use('default')
plt.style.use(s1)
df1 = rcParams_to_df(plt.rcParams,name=s1)
with plt.rc_context():
plt.style.use('default')
plt.style.use(s2)
df2 = rcParams_to_df(plt.rcParams,name=s2)
df = pd.concat([df1,df2],axis=1)
dif = df[df[s1] != df[s2]].dropna(how='all')
return (dif,df,df1,df2)
def main():
""" Main entry point of the app """
def usage():
print('\n Usage: rcparams