Created
March 21, 2021 06:31
-
-
Save hirocarma/79ac9b2f46836594dcc49f60c4db1f3d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import matplotlib.pyplot as plt | |
| import datetime | |
| import numpy as np | |
| plt.rcParams['font.family'] = 'sans-serif' | |
| plt.rcParams['font.sans-serif'] = ['IPAPGothic', 'VL PGothic'] | |
| dt0 = datetime.date(1977,1,1) | |
| dt1 = datetime.date(1977,10,20) | |
| dt2 = datetime.date(1992,9,25) | |
| dt3 = datetime.date(2001,3,1) | |
| dt4 = datetime.date(2005,8,3) | |
| dt5 = datetime.date(2021,1,6) | |
| based = 1976 | |
| d0 = (dt1-dt0).days/365+based | |
| d1 = (dt2-dt0).days/365+based | |
| d2 = (dt3-dt0).days/365+based | |
| d3 = (dt4-dt0).days/365+based | |
| d4 = (dt5-dt0).days/365+based | |
| year = [d0, d1 , d2, d3, d4] | |
| ver = [1, 47, 71, 82, 120] | |
| buy = ['初版','carma', 'tsunさん', 'rodydaddyさん','やみこさん'] | |
| av = round((ver[len(ver)-1] / year[len(year)-1] * 365),1) | |
| plt.figure(facecolor="azure", edgecolor="coral", linewidth=1) | |
| boxdic = { | |
| "facecolor" : "lightblue", | |
| "edgecolor" : "darkred", | |
| "boxstyle" : "Round", | |
| "linewidth" : 1 | |
| } | |
| plt.plot(year, ver , marker="X") | |
| plt.xticks(np.arange(1975, 2025, step=5)) | |
| for i, j in enumerate(year): | |
| plt.text(j+1, ver[i]-4, buy[i], color="blue") | |
| plt.text(year[0], ver[4]-5, "年間平均刷数: " + str(av) + "刷", bbox=boxdic) | |
| plt.vlines(year, 0, ver , colors='red', linestyle='dashed', linewidth=1) | |
| plt.title("『100万回生きたねこ』の刷数遷移") | |
| plt.xlabel("発行年") | |
| plt.ylabel("刷数") | |
| plt.grid(True) | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment