Skip to content Skip to sidebar Skip to footer

Overlapping Histogram In For Loop With Heapq.nlargest - Python

At the moment I've created a for loop which cycles through my arrays and dumps out the result on a PDF however I'm having trouble combining this with heapq.nlargest. I want to ove

Solution 1:

Solved it!

x = list(df1.columns.values)
fig = plt.figure(num=None, figsize=(30, 200),  dpi=80, facecolor='w',  edgecolor='w')


for i in range(len(df1.ix[i])):
    val= x[i]   
    y = df1.iloc[:,i]
    yy_s = np.sort(df1.iloc[:,i])[::-1]
    yy_s_trim0 = yy_s[np.where(yy_s > 0)]
    yy_10 = yy_s_trim0[0:(len(yy_s_trim0)/10)]

    ax = fig.add_subplot(len(df1.ix[0]),3,i+1)   
    plt.hist(y, bins=np.logspace(-4, 3, 100))
    plt.hist(yy_10, bins=np.logspace(-4, 3, 100))

Post a Comment for "Overlapping Histogram In For Loop With Heapq.nlargest - Python"