<jupyter_start><jupyter_text>Histogramme<jupyter_code>figHist, ax = plt.subplot_mosaic([["Boxplots Runden"]], figsize=[15, 6], layout="constrained")

makeHistogram(sorted_rc, ax["Boxplots Runden"], sorted_labels, colors, ncol=2, majorMultiple=10)
ax["Boxplots Runden"].set_xlim((20, 375))

for txt in ax["Boxplots Runden"].texts:
    if txt.get_position()[0] > 375:
        print(txt.get_text())
        txt.set_text(txt.get_text()+"→")
        txt.set_x(375)

[x for x in enumerate(sorted_labels)]
IDs = [2,0]
figHist2, ax = plt.subplot_mosaic([["Boxplots Runden"]], figsize=[15, 6], layout="constrained")

makeHistogram([sorted_rc[i] for i in IDs], ax["Boxplots Runden"], [sorted_labels[i] for i in IDs], [colors[i] for i in IDs])

def wer_gewinnt(winners,labels, figsize=[15, 5]):

    player0 = [s.count(["p0"]) / len(s) * 100 for s in winners]
    player1 = [s.count(["p1"]) / len(s) * 100 for s in winners]
    no_one = [s.count([]) / len(s) * 100 for s in winners]
    # both = [s.count(["p0", "p1"]) / len(s) * 100 for s in winners]
    # print(player0)
    # print(player1)

    fig, ax = plt.subplots(figsize=figsize, layout="constrained")
    # hat_graph(ax, xlabels, [player0, player1], ['Player 0', 'Player 1'])

    p0 = ax.bar(
        labels,
        player0,
        label="Spieler 0 Zufall",
        alpha=0.5,
        width=0.5,
        color=colors[0],
        hatch="///",
        edgecolor="dimgray",
    )
    p1 = ax.bar(
        labels,
        player1,
        label="Spieler 1",
        alpha=0.5,
        width=0.5,
        bottom=player0,
        color=colors,
        hatch="\\\\\\",
        edgecolor="dimgray",
    )
    # ab = ax.bar(labels, no_one, label="Abbruch", alpha=.5, width=.5, color=colors,
    #             hatch="...", bottom=[sum(x) for x in zip(player0, player1)])
    # ev = ax.bar(labels, both, label="Unentschieden", alpha=.5, width=.5, color=colors,
    #             hatch="***", bottom=[sum(x) for x in zip(player0, player1, no_one)])

    ax.bar_label(p0, label_type="center", fmt="%3.3g%%", padding=0)
    ax.bar_label(p1, label_type="center", fmt="%3.3g%%", padding=5)
    # ax.bar_label(ab, label_type='center', fmt=" "*10+"%3.2g%%", padding=5)
    # ax.bar_label(ev, label_type='center', fmt="%3.5g%%"+" "*30, padding=5)


    # Add some text for labels, title and custom x-axis tick labels, etc.
    ax.set_xlabel("Strategie Spieler 1")
    ax.set_title("Wer gewinnt")
    # ax.legend( loc='lower center', ncol=2)
    
    legendItem = mp.Patch(facecolor='none', edgecolor='gray', hatch="\\\\\\",
          label='Spieler 1')
    ax.legend(loc="upper left", ncol=2, handles=[legendItem,p0])
    ax.axhline(50, color=(0, 0, 0, 0.2), ls="--")

    fig.tight_layout()
    ax.set_yticks(np.linspace(0, 100, 11))

    ax.set_ylim(0,110)
    ax.yaxis.set_major_formatter(mt.PercentFormatter())
    ax.grid(axis="y", color=("gray"), alpha=0.3, ls="--")
    

    return fig

figWinners= wer_gewinnt(sorted_winners,sorted_labels,[13, 5])<jupyter_output>C:\Users\walli\AppData\Local\Temp/ipykernel_15408/3564363989.py:55: UserWarning: This figure was using constrained_layout, but that is incompatible with subplots_adjust and/or tight_layout; disabling constrained_layout.
  fig.tight_layout()<jupyter_text>Speichern der Grafiken<jupyter_code>figRounds.savefig("../../tex/game_ur_ba_thesis/img/Grafiken/Strategien/Vergleich_untereinander/rounds.png", dpi=300,)
figHist.savefig( "../../tex/game_ur_ba_thesis/img/Grafiken/Strategien/Vergleich_untereinander/Histogramm.png", dpi=300,)
figWinners.savefig( "../../tex/game_ur_ba_thesis/img/Grafiken/Strategien/Vergleich_untereinander/Winner.png", dpi=300,)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18028780885147977, 'fraction_numerical': 0.03964159652457236, 'mean_word_length': 3.7049808429118776, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '297679', 'license': 'MIT', 'n_tokens_mistral': 1508, 'n_tokens_neox': 1400, 'n_words': 259, 'path': 'src/statistiken/Strategievergleich_untereinander.ipynb', 'repo_name': 'LukasWallisch/game-ur-analysis', 'size': '3683'}