comparison fsd.py @ 39:00f5ca6bb610 draft

planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 5b3ab8c6467fe3a52e89f5a7d175bd8a0189018a-dirty
author mheinzl
date Wed, 24 Jul 2019 05:35:35 -0400
parents 28fb192858ea
children 54f0dac1c834
comparison
equal deleted inserted replaced
38:28fb192858ea 39:00f5ca6bb610
280 ticks1 = map(str, ticks) 280 ticks1 = map(str, ticks)
281 if maximumX > 20: 281 if maximumX > 20:
282 ticks1[len(ticks1) - 1] = ">20" 282 ticks1[len(ticks1) - 1] = ">20"
283 283
284 if to_plot[l] == "Relative frequencies": 284 if to_plot[l] == "Relative frequencies":
285 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.6, rwidth=0.8, density=True, color=colors) 285 w = [numpy.zeros_like(data) + 1. / len(data) for data in list_to_plot2]
286 counts_rel = ax.hist(list_to_plot2, weights=w,
287 bins=numpy.arange(1, 23), stacked=False, edgecolor="black",
288 linewidth=1, label=label, align="left", alpha=0.7, rwidth=0.8)
286 else: 289 else:
287 counts = ax.hist(list_to_plot2, bins=numpy.arange(minimumX, maximumX + 2), stacked=False, edgecolor="black", linewidth=1, label=label, align="left", alpha=0.6, rwidth=0.8, color=colors) 290 counts = ax.hist(list_to_plot2, bins=numpy.arange(minimumX, maximumX + 2), stacked=False, edgecolor="black", linewidth=1, label=label, align="left", alpha=0.7, rwidth=0.8, color=colors)
288 ax.legend(loc='upper right', fontsize=14, frameon=True, bbox_to_anchor=(0.9, 1)) 291 ax.legend(loc='upper right', fontsize=14, frameon=True, bbox_to_anchor=(0.9, 1))
289 292
290 ax.set_xticks(numpy.array(ticks)) 293 ax.set_xticks(numpy.array(ticks))
291 ax.set_xticklabels(ticks1) 294 ax.set_xticklabels(ticks1)
292 295
336 else: 339 else:
337 x = [xi + barWidth for xi in x] 340 x = [xi + barWidth for xi in x]
338 w = 1./(len(list_to_plot) + 1) 341 w = 1./(len(list_to_plot) + 1)
339 342
340 if to_plot[l] == "Relative frequencies": 343 if to_plot[l] == "Relative frequencies":
341 new_y = list(numpy.concatenate((numpy.array([yi / float(numpy.sum(y)) for yi in y])))) 344 counts2_rel = ax.bar(x, list(numpy.float_(y)) / numpy.sum(y), align="edge", width=w,
342 counts2_rel = ax.bar(x, new_y, align="edge", width=w, 345 edgecolor="black", label=label[i],linewidth=1, alpha=0.7, color=colors[i])
343 edgecolor="black", label=label[i],linewidth=1, alpha=0.6, color=colors[i])
344 346
345 else: 347 else:
346 y = list(y.reshape((len(y)))) 348 y = list(y.reshape((len(y))))
349
347 counts2 = ax.bar(x, y, align="edge", width=w, edgecolor="black", label=label[i], linewidth=1, 350 counts2 = ax.bar(x, y, align="edge", width=w, edgecolor="black", label=label[i], linewidth=1,
348 alpha=0.6, color=colors[i]) 351 alpha=0.7, color=colors[i])
349 if i == len(list_to_plot2): 352 if i == len(list_to_plot2):
350 barWidth += 1. / (len(list_to_plot) + 1) + 1. / (len(list_to_plot) + 1) 353 barWidth += 1. / (len(list_to_plot) + 1) + 1. / (len(list_to_plot) + 1)
351 else: 354 else:
352 barWidth += 1. / (len(list_to_plot) + 1) 355 barWidth += 1. / (len(list_to_plot) + 1)
353 356