python/cell_cycle_gating/plotting.py
def group_hist3d(dna_content, figsize=(8, 8), title=None, plot_num=0, figname=None):
    '''
    Make stacked histogram plots, each column is plotted as a series.
    '''
    #fig = plt.figure(figsize=figsize)
    #ax = plt.axes(projection='3d')
    #fig = plt.figure(figsize=(8, 4))
    grid_size=(2, 1)
    plot_num = plot_num % 2
    rel_pos = np.unravel_index(plot_num, grid_size)
    ax = plt.subplot2grid(grid_size, rel_pos, projection='3d')
    doses = list(dna_content.keys())
    verts = []
    for i, conc in enumerate(doses):
        hist_y, hist_x = np.histogram(dna_content[conc], 100, density=True)
        hist_x = hist_x[:-1]# + np.diff(hist_x[:2])
        verts.append(list(zip(hist_x, hist_y)))
        a = 0.1 * (i+1)
        #ax.bar3d(hist_x, i, 0, 0.1, 0.05, hist_y, color=(0.2, 0.7, 0.3, a), shade=False)#, alpha=0.2)
    poly = PolyCollection(verts, edgecolors='k')#, facecolors=[cc('r'), cc('g'), cc('b'), cc('y')])
    poly.set_alpha(0.7)
    ax.add_collection3d(poly, zs=np.arange(len(doses)), zdir='y')

    dna_content_values = []
    for k in dna_content.keys():
        dna_content_values += list(dna_content[k])
    
    ax.set_xlabel('log10(DNA content)')
    ax.set_xlim3d(4, 5)
    ax.set_ylabel('doses')
    ax.set_ylim3d(0, 9)
    #ax.set_zlabel('Z')
    ax.set_zlim3d(0, 5)
    ax.view_init(elev=67, azim=-45)
    ax.set_yticklabels(doses, fontsize=8)
    if title is not None:
        ax.set_title(title, fontsize=16)
    #if figname is not None:
    #    plt.savefig(figname)
    #else:
    #    return fig

    Make stacked histogram plots, each column is plotted as a series.
    
Make stacked histogram plots, each column is plotted as a series.
Make stacked histogram plots each column is plotted as a series .
def group_hist3d(dna_content, figsize=(8, 8), title=None, plot_num=0, figname=None):
    grid_size=(2, 1)
    plot_num = plot_num % 2
    rel_pos = np.unravel_index(plot_num, grid_size)
    ax = plt.subplot2grid(grid_size, rel_pos, projection='3d')
    doses = list(dna_content.keys())
    verts = []
    for i, conc in enumerate(doses):
        hist_y, hist_x = np.histogram(dna_content[conc], 100, density=True)
        hist_x = hist_x[:-1]
        verts.append(list(zip(hist_x, hist_y)))
        a = 0.1 * (i+1)
    poly = PolyCollection(verts, edgecolors='k')
    poly.set_alpha(0.7)
    ax.add_collection3d(poly, zs=np.arange(len(doses)), zdir='y')
    dna_content_values = []
    for k in dna_content.keys():
        dna_content_values += list(dna_content[k])
    ax.set_xlabel('log10(DNA content)')
    ax.set_xlim3d(4, 5)
    ax.set_ylabel('doses')
    ax.set_ylim3d(0, 9)
    ax.set_zlim3d(0, 5)
    ax.view_init(elev=67, azim=-45)
    ax.set_yticklabels(doses, fontsize=8)
    if title is not None:
        ax.set_title(title, fontsize=16)
def group_hist3d ( dna_content , figsize = ( 8 , 8 ) , title = None , plot_num = 0 , figname = None ) : grid_size = ( 2 , 1 ) plot_num = plot_num % 2 rel_pos = np . unravel_index ( plot_num , grid_size ) ax = plt . subplot2grid ( grid_size , rel_pos , projection = '3d' ) doses = list ( dna_content . keys ( ) ) verts = [ ] for i , conc in enumerate ( doses ) : hist_y , hist_x = np . histogram ( dna_content [ conc ] , 100 , density = True ) hist_x = hist_x [ : - 1 ] verts . append ( list ( zip ( hist_x , hist_y ) ) ) a = 0.1 * ( i + 1 ) poly = PolyCollection ( verts , edgecolors = 'k' ) poly . set_alpha ( 0.7 ) ax . add_collection3d ( poly , zs = np . arange ( len ( doses ) ) , zdir = 'y' ) dna_content_values = [ ] for k in dna_content . keys ( ) : dna_content_values += list ( dna_content [ k ] ) ax . set_xlabel ( 'log10(DNA content)' ) ax . set_xlim3d ( 4 , 5 ) ax . set_ylabel ( 'doses' ) ax . set_ylim3d ( 0 , 9 ) ax . set_zlim3d ( 0 , 5 ) ax . view_init ( elev = 67 , azim = - 45 ) ax . set_yticklabels ( doses , fontsize = 8 ) if title is not None : ax . set_title ( title , fontsize = 16 )
Make stacked histogram plots, each column is plotted as a series.
Make stacked histogram plots each column is plotted as a series .
'''
    Make stacked histogram plots, each column is plotted as a series.
    ''' #fig = plt.figure(figsize=figsize) #ax = plt.axes(projection='3d') #fig = plt.figure(figsize=(8, 4)) # + np.diff(hist_x[:2]) #ax.bar3d(hist_x, i, 0, 0.1, 0.05, hist_y, color=(0.2, 0.7, 0.3, a), shade=False)#, alpha=0.2) #, facecolors=[cc('r'), cc('g'), cc('b'), cc('y')]) #ax.set_zlabel('Z') #if figname is not None: #    plt.savefig(figname) #else: #    return fig
dna_content
figsize
title
plot_num
figname