【发布时间】:2016-10-31 11:59:30
【问题描述】:
我已阅读此处 (How to prevent numbers being changed to exponential form in Python matplotlib figure) 和此处 (Matplotlib: disable powers of ten in log plot) 并尝试了他们的解决方案,但均无济于事。
如何将我的 y 轴转换为显示普通十进制数字而不是科学记数法?请注意这是 Python 3.5.2。
这是我的代码:
#Imports:
import matplotlib.pyplot as plt
possible_chars = 94
max_length = 8
pw_possibilities = []
for num_chars in range(1, max_length+1):
pw_possibilities.append(possible_chars**num_chars)
x = range(1, max_length+1)
y = pw_possibilities
#plot
plt.figure()
plt.semilogy(x, y, 'o-')
plt.xlabel("num chars in password")
plt.ylabel("number of password possibilities")
plt.title("password (PW) possibilities verses # chars in PW")
plt.show()
【问题讨论】:
标签: python python-3.x matplotlib plot scientific-notation