use*_*828 5 python matplotlib pandas
使用下面的代码生成一个图,其中y轴为0.0到2.5 1e7.如何避免使用1e7的值?
import pandas as pd
import matplotlib.pyplot as plt
a = {'Test1': {1: 21867186, 4: 20145576, 10: 18018537},
'Test2': {1: 23256313, 4: 21668216, 10: 19795367}}
d = pd.DataFrame(a).T
#print d
f = plt.figure()
plt.title('Title here!', color='black')
d.plot(kind='bar', ax=f.gca())
plt.show()
Run Code Online (Sandbox Code Playgroud)
使用ticklabel_format(style = 'plain')如下例所示.
import pandas as pd
import matplotlib.pyplot as plt
a = {'Test1': {1: 21867186, 4: 20145576, 10: 18018537},
'Test2': {1: 23256313, 4: 21668216, 10: 19795367}}
d = pd.DataFrame(a).T
#print d
f = plt.figure()
plt.ticklabel_format(style = 'plain')
plt.title('Title here!', color='black')
d.plot(kind='bar', ax=f.gca())
plt.show()
Run Code Online (Sandbox Code Playgroud)
我希望这就是你的意思.