comparison fsd.py @ 38:28fb192858ea draft

planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
author mheinzl
date Mon, 03 Jun 2019 07:31:37 -0400
parents 67e34fc2b67a
children 00f5ca6bb610
comparison
equal deleted inserted replaced
37:67e34fc2b67a 38:28fb192858ea
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.8, rwidth=0.8, density=True, color=colors) 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)
286 else: 286 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.8, rwidth=0.8, color=colors) 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)
288 ax.legend(loc='upper right', fontsize=14, frameon=True, bbox_to_anchor=(0.9, 1)) 288 ax.legend(loc='upper right', fontsize=14, frameon=True, bbox_to_anchor=(0.9, 1))
289 289
290 ax.set_xticks(numpy.array(ticks)) 290 ax.set_xticks(numpy.array(ticks))
291 ax.set_xticklabels(ticks1) 291 ax.set_xticklabels(ticks1)
292 292
334 x = [xi * 0.5 for xi in x] 334 x = [xi * 0.5 for xi in x]
335 w = 0.4 335 w = 0.4
336 else: 336 else:
337 x = [xi + barWidth for xi in x] 337 x = [xi + barWidth for xi in x]
338 w = 1./(len(list_to_plot) + 1) 338 w = 1./(len(list_to_plot) + 1)
339
340
341 #print(label[i])
342 #print(colors[i])
343 #print(w)
344 #
345
346 #print(numpy.sum(y))
347 #print(float(numpy.sum(y)))
348 #print(x)
349 #print(new_y.shape)
350 #new_y = numpy.array(new_y).reshape((len(new_y)))
351 #print(new_y.shape)
352 #print(new_y)
353
354
355
356 #new_y_heights = [x[0] for x in new_y]
357 #print(new_y_heights)
358 #print(new_y.shape)
359 339
360 if to_plot[l] == "Relative frequencies": 340 if to_plot[l] == "Relative frequencies":
361 print("relative")
362 new_y = list(numpy.concatenate((numpy.array([yi / float(numpy.sum(y)) for yi in y])))) 341 new_y = list(numpy.concatenate((numpy.array([yi / float(numpy.sum(y)) for yi in y]))))
363 counts2_rel = ax.bar(x, new_y, align="edge", width=w, 342 counts2_rel = ax.bar(x, new_y, align="edge", width=w,
364 edgecolor="black", label=label[i],linewidth=1, alpha=0.8, color=colors[i]) 343 edgecolor="black", label=label[i],linewidth=1, alpha=0.6, color=colors[i])
365 344
366 else: 345 else:
367 y = list(y.reshape((len(y)))) 346 y = list(y.reshape((len(y))))
368 counts2 = ax.bar(x, y, align="edge", width=w, edgecolor="black", label=label[i], linewidth=1, 347 counts2 = ax.bar(x, y, align="edge", width=w, edgecolor="black", label=label[i], linewidth=1,
369 alpha=0.8, color=colors[i]) 348 alpha=0.6, color=colors[i])
370 if i == len(list_to_plot2): 349 if i == len(list_to_plot2):
371 barWidth += 1. / (len(list_to_plot) + 1) + 1. / (len(list_to_plot) + 1) 350 barWidth += 1. / (len(list_to_plot) + 1) + 1. / (len(list_to_plot) + 1)
372 else: 351 else:
373 barWidth += 1. / (len(list_to_plot) + 1) 352 barWidth += 1. / (len(list_to_plot) + 1)
374 353