3
このプログラムを実行して、特定のテキストの文字の分布を検索しています。プロットがJ(インデックス10)で停止する理由を説明できます
# this is a paragraph from python documentation :)
mytext = 'When a letter is first k encountered, it is missing from the mapping, so the default_factory function calls int() to supply a default count of zero. The increment operation then builds up the count for each letter.The function int() which always returns zero is just a special case of constant functions. A faster and more flexible way to create constant functions is to use a lambda function which can supply any constant value (not just zero):'
d = dict()
ignorelist = ('(',')',' ', ',', '.', ':', '_')
for n in mytext:
if(n not in ignorelist):
n = n.lower()
if n in d.keys():
d[n] = d[n] + 1
else:
d[n] = 1
xx = list(d.keys())
yy = list(d.values())
import matplotlib.pyplot as plt
plt.scatter(xx,yy, marker = '*')
plt.show()
リストには25個の要素があります。いくつかの奇妙な理由のために、プロットはこのように来ています。 x軸で 'J'で終わります。
ズームすると右側が表示されますが、ポイントはプロットされません。
私はこれについて[GitHubのトラッカー上の問題](https://github.com/matplotlib/matplotlib/issues/9843)を開きました。 – ImportanceOfBeingErnest