matplotlib - Anaconda Python 3.4 using Seaborn figure too tight -
i developing hierarchal clusters in form of dendrograms using python 3.4 , seaborn, using work of olga botvinnik (http://nbviewer.ipython.org/gist/olgabot/bfe1e3638af3eea52fb1#). goal cluster u.s. cities based on greenhouse gas emissions. able read csv file , create figure residential , commercial buildings emissions on x axis , city names on y axis, cannot see of city names because squished together. image needs elongated can read it. can point me in direction?
import pandas pd import seaborn sns import matplotlib.pyplot plt data = pd.read_csv('/users/jcmartel 1/desktop/ghg_directory/rescom.csv', index_col=0) data.index = data.index.map(lambda x: x.strip()) sns.clustermap(data); #need improve layout fig = plt.gcf() fig.savefig('clustermap_bbox_tight.png', bbox_inches='tight')
following final script using:
import pandas pd import seaborn sns import matplotlib.pyplot plt data = pd.read_csv('/users/jcmartel 1/desktop/ghg_directory/ghgmodel4.csv', index_col=0) data.index = data.index.map(lambda x: x.strip()) cmap = sns.cubehelix_palette(as_cmap=true, rot=-.3, light=1) sns.clustermap(data, col_cluster=false, cmap=cmap, linewidths=.5, figsize=(8, 30))
Comments
Post a Comment