comparison fsd.py @ 36:54ba0ad1263f 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:22:06 -0400
parents 56ad50707dc8
children 67e34fc2b67a
comparison
equal deleted inserted replaced
35:56ad50707dc8 36:54ba0ad1263f
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, normed=True) 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)
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) 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)
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
339 339
340 340
341 #print(label[i]) 341 #print(label[i])
342 #print(colors[i]) 342 #print(colors[i])
343 #print(w) 343 #print(w)
344 # linewidth=1, 344 #
345 345
346 #print(numpy.sum(y)) 346 #print(numpy.sum(y))
347 #print(float(numpy.sum(y))) 347 #print(float(numpy.sum(y)))
348 #print(x) 348 #print(x)
349 #print(new_y.shape) 349 #print(new_y.shape)
357 #print(new_y_heights) 357 #print(new_y_heights)
358 #print(new_y.shape) 358 #print(new_y.shape)
359 359
360 if to_plot[l] == "Relative frequencies": 360 if to_plot[l] == "Relative frequencies":
361 print("relative") 361 print("relative")
362 new_y = list(numpy.concatenate((numpy.array([yi / float(numpy.sum(y)) for yi in y])))) 362 #new_y = list(numpy.concatenate((numpy.array([yi / float(numpy.sum(y)) for yi in y]))))
363 363
364 counts2_rel = ax.bar(x, new_y, align="edge", width=w, 364 counts2_rel = ax.bar(x, list(numpy.float_(y)) / numpy.sum(y), align="edge", width=w,
365 edgecolor="black", label=label[i], alpha=0.8, color=colors[i]) 365 edgecolor="black", label=label[i],linewidth=1, alpha=0.8, color=colors[i])
366 366
367 else: 367 else:
368 print("absolute")
369 print(y.shape)
370 #print(x.shape)
371 print(y)
372 y = list(y.reshape((len(y)))) 368 y = list(y.reshape((len(y))))
373 369
374 counts2 = ax.bar(x, y, align="edge", width=w, edgecolor="black", label=label[i], 370 counts2 = ax.bar(x, y, align="edge", width=w, edgecolor="black", label=label[i], linewidth=1,
375 alpha=0.8, color=colors[i]) 371 alpha=0.8, color=colors[i])
376 if i == len(list_to_plot2): 372 if i == len(list_to_plot2):
377 barWidth += 1. / (len(list_to_plot) + 1) + 1. / (len(list_to_plot) + 1) 373 barWidth += 1. / (len(list_to_plot) + 1) + 1. / (len(list_to_plot) + 1)
378 else: 374 else:
379 barWidth += 1. / (len(list_to_plot) + 1) 375 barWidth += 1. / (len(list_to_plot) + 1)