Mercurial > repos > mheinzl > fsd
changeset 21:89ddbe5ae2aa draft
planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
author | mheinzl |
---|---|
date | Wed, 08 May 2019 07:21:18 -0400 |
parents | 64f0362c974e |
children | 5e650e66e058 |
files | fsd.py |
diffstat | 1 files changed, 7 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/fsd.py Wed May 08 07:14:49 2019 -0400 +++ b/fsd.py Wed May 08 07:21:18 2019 -0400 @@ -78,8 +78,7 @@ data_array_list = [] list_to_plot_original = [] colors = [] - bins = numpy.arange(1, 22) - + bins = numpy.arange(1, 22) with open(title_file, "w") as output_file, PdfPages(title_file2) as pdf: fig = plt.figure() fig.subplots_adjust(left=0.12, right=0.97, bottom=0.23, top=0.94, hspace=0) @@ -283,9 +282,9 @@ ticks1[len(ticks1) - 1] = ">20" if to_plot[l] == "Relative frequencies": - counts_rel = ax.hist(list_to_plot2, bins=numpy.arange(minimumX, maximumX + 2), stacked=False, edgecolor="black", linewidth=1, label=label, align="left", alpha=1, rwidth=0.8, normed=True) + counts_rel = ax.hist(list_to_plot2, bins=numpy.arange(minimumX, maximumX + 2), stacked=False, edgecolor="black", linewidth=1, label=label, align="left", alpha=0.8, rwidth=0.8, normed=True) else: - counts = ax.hist(list_to_plot2, bins=numpy.arange(minimumX, maximumX + 2), stacked=False, edgecolor="black", linewidth=1, label=label, align="left", alpha=1, rwidth=0.8) + counts = ax.hist(list_to_plot2, bins=numpy.arange(minimumX, maximumX + 2), stacked=False, edgecolor="black", linewidth=1, label=label, align="left", alpha=0.8, rwidth=0.8) ax.legend(loc='upper right', fontsize=14, frameon=True, bbox_to_anchor=(0.9, 1)) ax.set_xticks(numpy.array(ticks)) @@ -316,17 +315,14 @@ unique, c = numpy.unique(list_to_plot2[i], return_counts=True) new_c = [] new_unique = [] - for t in ticks: if t not in unique: - new_c.append(0) # add zero count of not occuring + new_c.append(0) # add zero count of not occuring new_unique.append(t) else: c_idx = numpy.where(t == unique)[0] new_c.append(c[c_idx]) new_unique.append(unique[c_idx]) - print(new_unique) - print(new_c) y = numpy.array(new_unique) * numpy.array(new_c) if len([list_to_plot_original > 20]) > 0: y[len(y) - 1] = sum(list_to_plot_original[i][list_to_plot_original[i] > 20]) @@ -338,10 +334,10 @@ if to_plot[l] == "Relative frequencies": counts2_rel = ax.bar(x, list(numpy.float_(y)) / sum(y), align="edge", width=1./(len(list_to_plot) + 1), - edgecolor="black", label=label[i], alpha=1, linewidth=1, color=colors[i]) + edgecolor="black", label=label[i], alpha=0.8, linewidth=1, color=colors[i]) else: - counts2 = ax.bar(x, y, align="edge", width=1./len(list_to_plot), edgecolor="black", label=label[i], - alpha=1, linewidth=1, color=colors[i]) + counts2 = ax.bar(x, y, align="edge", width=1./(len(list_to_plot) + 1), edgecolor="black", label=label[i], + alpha=0.8, linewidth=1, color=colors[i]) if i == len(list_to_plot2): barWidth += 1. / (len(list_to_plot) + 1) + 1. / (len(list_to_plot) + 1) else: