Skip to content

Instantly share code, notes, and snippets.

@Fallen-Breath
Last active January 16, 2025 18:16

Revisions

  1. Fallen-Breath revised this gist Jan 16, 2025. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions wiske_data.py
    Original file line number Diff line number Diff line change
    @@ -3,14 +3,16 @@
    import numpy as np

    plt.rcParams['font.family'] = 'Source Han Sans SC'
    include_pre = False
    include_pre = True

    data = {
    '1.18.1': {'无游走': 6121, '普通方块游走': 6273, '地狱砖游走': 7205},
    '1.18.2-pre1': {'无游走': 7576, '普通方块游走': 7603, '地狱砖游走': 7313},
    '1.18.2-pre2': {'无游走': 6231, '普通方块游走': 6266, '地狱砖游走': 6199},
    '1.18.2-pre3': {'无游走': 6010, '普通方块游走': 6151, '地狱砖游走': 5702},
    '1.18.2': {'无游走': 6194, '普通方块游走': 6168, '地狱砖游走': 5637},
    '1.21.4': {'无游走': 6252, '普通方块游走': 6197, '地狱砖游走': 5747},
    '25w03a': {'无游走': 6108, '普通方块游走': 6179, '地狱砖游走': 7360},
    }
    if not include_pre:
    for key in list(data.keys()):
    @@ -37,7 +39,7 @@
    for bar in bars:
    ax.text(bar.get_x() + bar.get_width() / 2, bar.get_height(), str(int(bar.get_height())), ha='center', va='bottom', rotation=0, fontsize=8 if include_pre else 10)

    ax.legend(title='场景', loc='upper right')
    ax.legend(title='场景', loc='best')

    ax.set_xticks(index)
    ax.set_xticklabels(df['version'].unique())
  2. Fallen-Breath revised this gist May 6, 2024. No changes.
  3. Fallen-Breath created this gist May 6, 2024.
    49 changes: 49 additions & 0 deletions wiske_data.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    import pandas as pd
    import matplotlib.pyplot as plt
    import numpy as np

    plt.rcParams['font.family'] = 'Source Han Sans SC'
    include_pre = False

    data = {
    '1.18.1': {'无游走': 6121, '普通方块游走': 6273, '地狱砖游走': 7205},
    '1.18.2-pre1': {'无游走': 7576, '普通方块游走': 7603, '地狱砖游走': 7313},
    '1.18.2-pre2': {'无游走': 6231, '普通方块游走': 6266, '地狱砖游走': 6199},
    '1.18.2-pre3': {'无游走': 6010, '普通方块游走': 6151, '地狱砖游走': 5702},
    '1.18.2': {'无游走': 6194, '普通方块游走': 6168, '地狱砖游走': 5637},
    }
    if not include_pre:
    for key in list(data.keys()):
    if '-pre' in key:
    data.pop(key)

    rows = []
    for version, values in data.items():
    for category, count in values.items():
    rows.append({'version': version, 'category': category, 'rate': count})
    df = pd.DataFrame(rows)

    fig, ax = plt.subplots(figsize=(10 if include_pre else 6, 6), dpi=200)

    bar_width = 0.2
    index = np.arange(len(df['version'].unique()))

    bar_colors = {'无游走': 'lightblue', '普通方块游走': 'y', '地狱砖游走': 'lightcoral'}
    bar_shift = {'无游走': -1, '普通方块游走': 0, '地狱砖游走': 1}

    for c, group in sorted(df.groupby('category', sort=False), key=lambda t: bar_shift[t[0]]):
    cnt = group.groupby('version', sort=False)['rate'].sum()
    bars = ax.bar(index + bar_width * bar_shift[c], cnt, bar_width, label=c, color=bar_colors[c])
    for bar in bars:
    ax.text(bar.get_x() + bar.get_width() / 2, bar.get_height(), str(int(bar.get_height())), ha='center', va='bottom', rotation=0, fontsize=8 if include_pre else 10)

    ax.legend(title='场景', loc='upper right')

    ax.set_xticks(index)
    ax.set_xticklabels(df['version'].unique())
    ax.set_xlabel('MC版本')
    ax.set_ylabel('凋灵骷髅/h')
    plt.ylim(0, 8500)
    plt.axhline(y=6100, color='gray', linestyle='--', linewidth=1)
    plt.tight_layout()
    plt.show()