跳转到内容

File:WPVG Newsletter 202507 Feature Graph 1 (zh-tw).png

维基百科,自由的百科全书

原始文件 (2,370 × 2,370像素,文件大小:239 KB,MIME类型:image/png

摘要

[编辑]
文件信息
描述

電子遊戲專題簡訊2025年7月刊專題報導插圖——專題二十年各項統計指標

來源

原始碼:

import matplotlib as mpl
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import pandas as pd
from matplotlib.ticker import FuncFormatter

texts = {
    'zh-tw': {
        'total_articles': '條目總數',
        'total_dyk': '新條目推薦總數',
        'new_ga': '新增優良條目數',
        'talk_page_size': '專題討論頁各年存檔大小',
        'ylabel_count': '條目數',
        'ylabel_bytes': '位元組數',
        'font_family': 'Source Han Sans TC',
    },
    'zh-cn': {
        'total_articles': '条目总数',
        'total_dyk': '新条目推荐总数',
        'new_ga': '新增优秀条目数',
        'talk_page_size': '专题讨论页各年存档大小',
        'ylabel_count': '条目数',
        'ylabel_bytes': '字节数',
        'font_family': 'Source Han Sans SC',
    }
}

lang = 'zh-tw'
lt = texts[lang]

mpl.rcParams['font.family'] = ['DejaVu Sans', lt['font_family']]

def thousands(x, pos):
    return '%1.0fk' % (x * 1e-3) if x != 0 else '0'
formatter = FuncFormatter(thousands)

fig, ax = plt.subplots(2, 1, figsize=(8, 8), sharex=True)

# Figure 1

total_articles_dates = [
    '2002-09-30', '2002-12-31', '2003-03-31', '2003-06-30', '2003-09-30', '2003-12-31', '2004-03-31', '2004-06-30', '2004-09-30', '2004-12-31', '2005-03-31', '2005-06-30', '2005-09-30', '2005-12-31', '2006-03-31', '2006-06-30', '2006-09-30', '2006-12-31', '2007-03-31', '2007-06-30', '2007-09-30', '2007-12-31', '2008-03-31', '2008-06-30', '2008-09-30', '2008-12-31', '2009-03-31', '2009-06-30', '2009-09-30', '2009-12-31', '2010-03-31', '2010-06-30', '2010-09-30', '2010-12-31', '2011-03-31', '2011-06-30', '2011-09-30', '2011-12-31', '2012-03-31', '2012-06-30', '2012-09-30', '2012-12-31', '2013-03-31', '2013-06-30', '2013-09-30', '2013-12-31', '2014-03-31', '2014-06-30', '2014-09-30', '2014-12-31', '2015-03-31', '2015-06-30', '2015-09-30', '2015-12-31', '2016-03-31', '2016-06-30', '2016-09-30', '2016-12-31', '2017-03-31', '2017-06-30', '2017-09-30', '2017-12-31', '2018-03-31', '2018-06-30', '2018-09-30', '2018-12-31', '2019-03-31', '2019-06-30', '2019-09-30', '2019-12-31', '2020-03-31', '2020-06-30', '2020-09-30', '2020-12-31', '2021-03-31', '2021-06-30', '2021-09-30', '2021-12-31', '2022-03-31', '2022-06-30', '2022-09-30', '2022-12-31', '2023-03-31', '2023-06-30', '2023-09-30', '2023-12-31', '2024-03-31', '2024-06-30', '2024-09-30', '2024-12-31', '2025-03-31', '2025-05-23'
]
total_articles_counts = [
    0, 0, 1, 7, 14, 15, 39, 57, 71, 93, 155, 215, 354, 439, 508, 618, 716, 816, 946, 1100, 1242, 1359, 1483, 1622, 1771, 1938, 2095, 2261, 2402, 2506, 2627, 2771, 2950, 3054, 3169, 3276, 3413, 3534, 3681, 3834, 3995, 4154, 4298, 4446, 4602, 4747, 4874, 5009, 5221, 5383, 5603, 5817, 6169, 6525, 6759, 6940, 7073, 7203, 7378, 7594, 7798, 7984, 8139, 8367, 8512, 8618, 8732, 8906, 9049, 9197, 9329, 9495, 9646, 9729, 9883, 10026, 10203, 10370, 10562, 10702, 10843, 10966, 11099, 11226, 11389, 11539, 11624, 11710, 11858, 11945, 12060, 12109
]
total_dyk_dates = [
    "2006-06-30", "2006-09-30", "2006-12-31", "2007-03-31", "2007-06-30", "2007-09-30", "2007-12-31",
    "2008-03-31", "2008-06-30", "2008-09-30", "2008-12-31", "2009-03-31", "2009-06-30", "2009-09-30",
    "2009-12-31", "2010-03-31", "2010-06-30", "2010-09-30", "2010-12-31", "2011-03-31", "2011-06-30",
    "2011-09-30", "2011-12-31", "2012-03-31", "2012-06-30", "2012-09-30", "2012-12-31", "2013-03-31",
    "2013-06-30", "2013-09-30", "2013-12-31", "2014-03-31", "2014-06-30", "2014-09-30", "2014-12-31",
    "2015-03-31", "2015-06-30", "2015-09-30", "2015-12-31", "2016-03-31", "2016-06-30", "2016-09-30",
    "2016-12-31", "2017-03-31", "2017-06-30", "2017-09-30", "2017-12-31", "2018-03-31", "2018-06-30",
    "2018-09-30", "2018-12-31", "2019-03-31", "2019-06-30", "2019-09-30", "2019-12-31", "2020-03-31",
    "2020-06-30", "2020-09-30", "2020-12-31", "2021-03-31", "2021-06-30", "2021-09-30", "2021-12-31",
    "2022-03-31", "2022-06-30", "2022-09-30", "2022-12-31", "2023-03-31", "2023-06-30", "2023-09-30",
    "2023-12-31", "2024-03-31", "2024-06-30", "2024-09-30", "2024-12-31", "2025-03-31", "2025-05-19"
]
total_dyk_counts = [
    0, 6, 7, 18, 28, 32, 35, 41, 48, 54, 61, 66, 75, 97, 101, 105, 109, 121, 132, 136, 136, 153, 156, 164, 174, 183, 192,
    225, 251, 310, 357, 370, 393, 418, 423, 432, 449, 474, 487, 503, 514, 532, 538, 546, 564, 583, 596, 617, 649, 669,
    691, 703, 718, 737, 749, 765, 793, 814, 833, 859, 876, 892, 923, 961, 997, 1015, 1043, 1073, 1091, 1137, 1162, 1183,
    1202, 1237, 1251, 1279, 1293
]

total_articles_df = pd.DataFrame({'date': pd.to_datetime(total_articles_dates), 'count': total_articles_counts})
total_dyk_df = pd.DataFrame({'date': pd.to_datetime(total_dyk_dates), 'count': total_dyk_counts})

ax1 = ax[0]
ax2 = ax[0].twinx()

ax1.plot(total_articles_df['date'], total_articles_df['count'], linestyle='-', label=lt['total_articles'], linewidth=3, color='C2')
ax2.plot(total_dyk_df['date'], total_dyk_df['count'], linestyle='-', label=lt['total_dyk'], linewidth=3, color='C0')

ax[0].xaxis.set_major_locator(mdates.YearLocator())
ax[0].xaxis.set_major_formatter(mdates.DateFormatter('%Y'))

lines1, labels1 = ax1.get_legend_handles_labels()
lines2, labels2 = ax2.get_legend_handles_labels()
ax[0].legend(lines1 + lines2, labels1 + labels2, loc='upper left')

ax1.set_ylabel(lt['ylabel_count'])
ax2.set_ylabel(lt['ylabel_count'])

ax[0].set_xlim(pd.to_datetime("2005-01-01"), pd.Timestamp.today())
ax1.set_ylim(0, 14900)
ax2.set_ylim(0, 1490)
ax1.yaxis.set_major_formatter(formatter)
ax1.grid()

# Figure 2

new_ga_years = [2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024]
new_ga_counts = [2, 5, 0, 1, 6, 9, 2, 7, 3, 3, 11, 14, 36, 28, 31, 25, 12]
talk_page_size_years = [2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024]
talk_page_size_values = [489, 664, 1406, 2154, 2175, 1491, 17, 1974, 34371, 15460, 41033, 83149, 17328, 68765, 77746, 42789, 284816, 413280, 381997, 126931]

new_ga_dt = pd.to_datetime([f"{y}-01-01" for y in new_ga_years])
talk_page_size_dt = pd.to_datetime([f"{y}-01-01" for y in talk_page_size_years])

ax1 = ax[1]
ax2 = ax[1].twinx()

ax1.bar(new_ga_dt, new_ga_counts, label=lt['new_ga'], color='C2', width=280, alpha=0.5)
ax2.bar(talk_page_size_dt, talk_page_size_values, label=lt['talk_page_size'], color='C0', width=140)

ax[1].xaxis.set_major_locator(mdates.YearLocator())
ax[1].xaxis.set_major_formatter(mdates.DateFormatter('%Y'))

lines1, labels1 = ax1.get_legend_handles_labels()
lines2, labels2 = ax2.get_legend_handles_labels()
ax[1].legend(lines1 + lines2, labels1 + labels2, loc='lower left')

ax1.set_ylabel(lt['ylabel_count'])
ax2.set_ylabel(lt['ylabel_bytes'])

ax[1].set_xlim(pd.to_datetime("2005-01-01"), pd.Timestamp.today())
ax1.set_ylim(0, 44)
ax2.set_ylim(0, 440000)
ax2.yaxis.set_major_formatter(formatter)
ax1.grid()
ax1.invert_yaxis()
ax2.invert_yaxis()

# Formatting on the x-ticks
ax[0].xaxis.set_ticks_position('bottom')
plt.setp(ax[0].get_xticklabels(), rotation=45)
ax[1].tick_params(axis='x', which='both', bottom=False, top=True, labelbottom=False)

plt.tight_layout()
fig.subplots_adjust(hspace=0.15)

plt.savefig(f'WPVG Newsletter 202507 Feature Graph 1 ({lang}).png', dpi=300, bbox_inches='tight')
plt.show()
日期

2025-05-24

作者

SuperGrey

授權許可
(重用此文件)

參見下方。

其他版本

授權協議

[编辑]
我,本作品的著作權持有者,決定用以下授權條款發佈本作品:
您可以選擇您想要的授權條款。

文件历史

点击某个日期/时间查看对应时刻的文件。

日期/时间缩⁠略⁠图大小用户备注
当前2025年5月24日 (六) 20:192025年5月24日 (六) 20:19版本的缩略图2,370 × 2,370​(239 KB)SuperGrey留言 | 贡献{{Information |Description = 電子遊戲專題簡訊2025年7月刊專題報導插圖——專題二十年各項統計指標 |Source = 原始碼: <syntaxhighlight lang="python"> import matplotlib as mpl import matplotlib.dates as mdates import matplotlib.pyplot as plt import pandas as pd from matplotlib.ticker import FuncFormatter texts = { 'zh-tw': { 'total_articles': '條目總數', 'total_dyk': '新條目推薦總數', 'new_ga': '新增優良條目數', 'talk_page_size': '專題討論頁各年存檔大小', 'ylabel_count': '條目數', 'ylabel_bytes': '位元組數',…

元数据