4月13日の週から、今週まで東京都のデータ入れて、matplotlibで3D化してみた。
これだと減ってる様子は見て取れないけど、東洋経済のサイトのグラフだと実行再生算数1切ってるんだよね。
下記のコードは好きに使ってくださいな。
---
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
x = np.array([-1, -2, -3, -4, -5, -6, -7]) # from Mon to Sun
y = np.array([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]) # From Apr13 to onward
X, Y = np.meshgrid(x, y)
# Number Data of New Infection Patient
Z = np.array([[ 98,161,127,150,204,185,107], # Apr13
[100,123,125,134,166,107,76], # Apr20
[40,112, 47, 46, 164,159, 90], # Apr27
[87, 57, 37, 23, 39, 36, 22], # May4
[15, 28, 10, 30, 9, 14, 5], # May11
[ 10, 5, 5, 11, 3, 2, 14], # May18
[ 8, 10, 11, 15, 22, 14, 5], # May25
[ 13, 34, 12, 28, 20, 26, 14], # Jul1
[ 13, 12, 18, 22, 25, 24, 47], # Jul8
[ 48, 27, 16, 41, 35, 39, 35], # Jul15
[ 29, 31, 55, 48, 54, 57, 60], # Jul22
[ 58, 54, 67,107,124,130,111], # Jul29
[102,106, 75,224,243,206,206], # Jul6
[119,143,165,286,293,290,188], # Jul13
[168,237,238,366,260,295,239], # Jul20
[131,266,250,367,463,472,292], # Jul27
[282,276,260,377,473,482,302]]) # Aug3 : encliding expectations = prev week number + 10
fig = plt.figure(figsize=(10,8))
ax.set_xlabel('Day', fontsize=16)
ax.set_ylabel('Week', fontsize=16)
ax.get_proj = lambda: np.dot(Axes3D.get_proj(ax), np.diag([0.8, 1.2, 1, 1]))
ax.plot_wireframe(X, Y, Z)
ax.plot_surface(X, Y, Z, cmap=plt.cm.jet, rstride=1, cstride=1, linewidth=0)
plt.show()