I have just recently started to use matplotlib and seaborn to plot my graphs. This is the code that I wrote so far
count = 1
l=[13,0,47,29,10]
plt.figure(figsize=(30,40))
for ww in l:
temp_dict = defaultdict(list)
entropies = list()
for k,v in df.ix[ww].iteritems():
e = 0
for i in v:
temp_dict[k].append(float(i))
if not float(i) == 0:
e += -1.0*float(i)*log10(float(i))
entropies.append(e)
y = entropies
x=(range(len(entropies)))
slope, intercept, r_value, p_value, std_err = stats.linregress(x,y)
plt.subplot(len(lista_autori),2,count)
tdf = pd.DataFrame.from_dict(temp_dict, orient='columns')
a = tdf.dropna()
sns.set(font_scale=2)
#sns.factorplot(size=2, aspect=1)
sns.heatmap(a,linewidths=.5,cmap="RdBu_r")
plt.xlabel(ur'year')
plt.ylabel(ur'$PACS$')
count +=1
plt.subplot(len(lista_autori),2,count)
plt.plot(x,y)
x1 = (range(28))
y1 = [slope*i + intercept for i in x1]
plt.plot(x1,y1)
count +=1
plt.tight_layout();
The result is the following:
I would like to resize each row, assigning 2/3 of the row to the left hand side picture, the remaining to the right one. I tried to look at the answer given here but I found some difficulties when I have to mix ax and seaborn's heatmap. Any help or other solutions?