【问题标题】:Exponential value plotting in Python [closed]Python中的指数值绘图[关闭]
【发布时间】:2022-01-21 02:15:33
【问题描述】:

我有一个指数值列表,我想用 Python 绘制分布。怎么做才有意义?

我的值是这样的列表:

[0.0, 1.05e-84, 1.05e-84, 1.05e-84, 1.05e-84, 1.05e-84, 1.05e-84, 4.27e-35, 0.0, 3.18e-86, 3.18e-86, 3.18e-86, 3.61e-56, 1.92e-16, 7.3e-13, 7.3e-13, 7.3e-13, 9.04e-11, 9.04e-11, 2.3e-08, 4.3e-08, 4.3e-08, 0.000159, 0.000159, 0.0, 0.0, 0.18, 6.6, 3.0, 3.2, 4.6, 6.4, 7.7, 8.4, 8.8, 9.0, 8.92e-80, 7.8e-53, 7.8e-53, 1.33e-51, 2.56e-51, 2.56e-51, 2.56e-51, 2.56e-51, 2.6, 2.6, 2.6, 2.6, 2.6, 3.9, 3.9, 3.9, 3.9, 9.45e-166, 5.69e-44, 8.34e-44, 8.34e-44, 1.39e-43, 1.39e-43]

我需要这个图来决定另一个分析的阈值。 我要找的是这样的(数据类型相同):https://www.researchgate.net/figure/E-value-distribution-of-contig-sequences-BLAST-results-in-the-sweetpotato-root_fig3_247770651

如果更简单的话,我也想使用 gnuplot 代替 Python。

谢谢

【问题讨论】:

  • 我不确定带有“9.04e+11”和“3.18e-86”的情节怎么可能有任何意义。你当然可以做一个对数图,但即使这样也有问题。

标签: python plot gnuplot analysis exponential


【解决方案1】:

这是你的想法吗?

import numpy as np
import matplotlib.pyplot as plt

data = np.array([0.0, 1.05e-84, 1.05e-84, 1.05e-84, 1.05e-84, 1.05e-84, 1.05e-84, 4.27e-35, 0.0, 3.18e-86, 3.18e-86, 3.18e-86, 3.61e-56, 1.92e-16, 7.3e-13, 7.3e-13, 7.3e-13, 9.04e-11, 9.04e-11, 2.3e-08, 4.3e-08, 4.3e-08, 0.000159, 0.000159, 0.0, 0.0, 0.18, 6.6, 3.0, 3.2, 4.6, 6.4, 7.7, 8.4, 8.8, 9.0, 8.92e-80, 7.8e-53, 7.8e-53, 1.33e-51, 2.56e-51, 2.56e-51, 2.56e-51, 2.56e-51, 2.6, 2.6, 2.6, 2.6, 2.6, 3.9, 3.9, 3.9, 3.9, 9.45e-166, 5.69e-44, 8.34e-44, 8.34e-44, 1.39e-43, 1.39e-43])

plt.plot(data)
plt.yscale('log')
plt.show()

输出:

跟进

这会生成您的值的指数的直方图。请注意,我必须将零更改为一以允许 log10 调用。

import numpy as np
import matplotlib.pyplot as plt

data = np.array([0.0, 1.05e-84, 1.05e-84, 1.05e-84, 1.05e-84, 1.05e-84, 1.05e-84, 4.27e-35, 0.0, 3.18e-86, 3.18e-86, 3.18e-86, 3.61e-56, 1.92e-16, 7.3e-13, 7.3e-13, 7.3e-13, 9.04e-11, 9.04e-11, 2.3e-08, 4.3e-08, 4.3e-08, 0.000159, 0.000159, 0.0, 0.0, 0.18, 6.6, 3.0, 3.2, 4.6, 6.4, 7.7, 8.4, 8.8, 9.0, 8.92e-80, 7.8e-53, 7.8e-53, 1.33e-51, 2.56e-51, 2.56e-51, 2.56e-51, 2.56e-51, 2.6, 2.6, 2.6, 2.6, 2.6, 3.9, 3.9, 3.9, 3.9, 9.45e-166, 5.69e-44, 8.34e-44, 8.34e-44, 1.39e-43, 1.39e-43])

data += (data==0.0).astype(int)
data1 = -np.log10( data ).astype( int )
print(data1)

plt.hist(data1, 60)
plt.show()

输出:

【讨论】:

  • 谢谢,实际上我正在尝试做一些类似于我现在在主帖中上传的图片
  • 所以您正在寻找以 10 为基数的值的直方图。
猜你喜欢
  • 2019-02-02
  • 1970-01-01
  • 2013-09-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-03-19
  • 2018-12-29
  • 2021-09-20
相关资源
最近更新 更多