|
From: Asma R. <asm...@gm...> - 2014-03-05 20:19:45
|
Hi
I am trying to merge a heat map(matplotlib) with a tree(.png), but the .png
does not plot as needed or for that matter cannot be seen easily. Here is
my code:
####### CODE
cmap = mpl.cm.hot
if outlier==0:
threshold=1
else:
threshold=outlier-0.01
fig = plt.figure(figsize=(25,25))
plt.suptitle(file_handle.replace('.csv',''),fontsize=22)
cmap.set_over('green')
cmap.set_under('grey')
gs=gridspec.GridSpec(1, 2,height_ratios=[1,1,-2,2]
,width_ratios=[1,1,-2,2])
phyl_ax=plt.subplot(gs[0],frameon=False)
ht_ax=plt.subplot(gs[1])
##gs.tight_layout(fig, rect=[1,1,2,2])
ht_ax.set_xlim(0,35)
ht_ax.set_ylim(0,35)
##ht_ax.grid(color='white',linestyle='-',linewidth=1)
fig.subplots_adjust(hspace=0)
cb_ax,kw =mpl.colorbar.make_axes(ht_ax, shrink=0.65)
plt.setp(phyl_ax.get_xticklabels(),visible=False)
plt.setp(phyl_ax.get_yticklabels(),visible=False)
plt.setp(ht_ax.get_xticklabels(),visible=True)
plt.setp(ht_ax.get_yticklabels(),visible=True)
plt.setp(phyl_ax.get_xticklines(),visible=False)
plt.setp(phyl_ax.get_yticklines(),visible=False)
plt.setp(ht_ax.get_xticklines(),visible=True)
plt.setp(ht_ax.get_yticklines(),visible=True)
img = ht_ax.imshow(data, cmap=cmap, interpolation='none',vmax=threshold)
cb = mpl.colorbar.ColorbarBase(ax=cb_ax,cmap=cmap,
extend='neither',**kw)
cb.cmap.set_over('green')
image_file =
cbook.get_sample_data('/home/asmariyaz/Desktop/mytree.png',asfileobj=False)
image = plt.imread(image_file)
How can I make the resolution of the .png image better OR for that matter
is there a better solution to merge these together?
I am attaching the plot I am getting with this code- (WrongTree.pdf)
Thanks
Asma
|