|
From: Paul H. <pmh...@gm...> - 2014-03-05 20:35:07
|
Olga Botnivik is doing some work with these types of figures in her fork of the seaborn project. Example here: http://nbviewer.ipython.org/gist/olgabot/8341784 Link to the PR in github: https://github.com/mwaskom/seaborn/pull/73 Those might be a good place to start. On Wed, Mar 5, 2014 at 12:19 PM, Asma Riyaz <asm...@gm...> wrote: > 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 > > > ------------------------------------------------------------------------------ > Subversion Kills Productivity. Get off Subversion & Make the Move to > Perforce. > With Perforce, you get hassle-free workflows. Merge that actually works. > Faster operations. Version large binaries. Built-in WAN optimization and > the > freedom to use Git, Perforce or both. Make the move to Perforce. > > http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |