機械学習やビッグデータの解析では,大量にある多次元データを様々な側面から見る必要がある.ここでは,matplotlibを用いた円グラフの作成方法を学ぶ.
まずは簡単な円グラフを描画してみよう.
from numpy.random import default_rng import matplotlib.pyplot as plt
def main():
rg = default_rng(seed=0)
students_count = 280
scores = rg.normal(65.9, 10.8, students_count)
s_count = (90 <= scores).sum()
a_count = ((80 <= scores) & (scores < 90)).sum()
b_count = ((70 <= scores) & (scores < 80)).sum()
c_count = ((60 <= scores) & (scores < 70)).sum()
d_count = ((50 <= scores) & (scores < 60)).sum()
e_count = (scores < 50).sum()
fig = plt.figure(figsize=plt.figaspect(1.0))
ax = fig.add_subplot()
ax.pie([s_count, a_count, b_count, c_count, d_count, e_count])
plt.show()
if __name__ == '__main__':
main()
XX is ~
XX discribe is ~
example.
XXX = XX + X
[[kiji-template]] * Name * Contents #contents * What's XX XX is ~ * Discribe XX discribe is ~ example. XXX = XX + X * 1. ** 1.1. *** 1.1.1 + ① ++ ② +++ ③ - ・1 -- ・2 --- ・3 | | |h | | | | | | ----