docstring for plot_contribution
(ax, bins, v, style)
| 463 | |
| 464 | |
| 465 | def plot_contribution(ax, bins, v, style): |
| 466 | '''docstring for plot_contribution''' |
| 467 | ctri = np.array(range(len(bins)-1)) |
| 468 | ymin, ymax = ax.get_ylim() |
| 469 | for i in range(len(bins)-1): |
| 470 | t = v[bins[i]<=v] |
| 471 | t = t[t<bins[i+1]] |
| 472 | ctri[i] = t.sum() |
| 473 | x = [(bins[i]+bins[i+1])/2 for i in range(len(bins)-1)] |
| 474 | nx, ny = ax_normed_data(x, ctri, ymax) |
| 475 | ax.plot(nx, ny, style) |
| 476 | |
| 477 | losex = [] |
| 478 | losey = [] |
| 479 | winx = [] |
| 480 | winy = [] |
| 481 | for i in range(len(x)): |
| 482 | if x[i]<0: |
| 483 | losex.append(x[i]) |
| 484 | losey.append(ctri[i]) |
| 485 | else: |
| 486 | winx.append(x[i]) |
| 487 | winy.append(ctri[i]) |
| 488 | losey = [i for i in accumulate(losey[::-1])] |
| 489 | losey = losey[::-1] |
| 490 | winy = [i for i in accumulate(winy)] |
| 491 | nx, ny = ax_normed_data(x, np.array(losey+winy), ymax) |
| 492 | ax.plot(nx, ny, 'k') |
| 493 | |
| 494 | |
| 495 | def plot_summary2(fig, rtn, entry_best, data_win, data_lose, exit_profit, |
no test coverage detected