【发布时间】:2016-04-08 00:36:04
【问题描述】:
我在seaborn 中有以下 float 结果:
[7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.3e-05, 7.4e-05, 7.3e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.3e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.3e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05, 7.4e-05]
如您所见,为我绘制禁用科学计数法的图表:
结果函数:
def result(values, time):
x = 0.000000000001
max = 0.000000001
min = 0.001
y = [(1.0*i*(max/min) for i in values]
return generate((y, time))
以及生成图表的函数:
def generate(data_):
data, time = data_
img = StringIO.StringIO()
sns.set_style("darkgrid")
plt.plot(time, data)
plt.savefig(img, format=format_)
img.seek(0)
x = base64.b64encode(img.getvalue())
return x
以下消息来源告诉我seaborn 默认情况下以科学计数法设置值。但在这种情况下,我的结果是浮动的。
Seaborn showing scientific notation in heatmap for 3-digit numbers
Prevent scientific notation in seaborn boxplot
How to prevent numbers being changed to exponential form in Python matplotlib figure
How to avoid scientific notation when annotating a seaborn clustermap?
浮动结果重要吗?
【问题讨论】:
标签: python matplotlib flask list-comprehension seaborn