我有一个txt文件,有两列,240k行,像这样
1 2
2 3
. .
. .
4 5
7 9
10 8
12 9
. .
. .
e-3 72
等。在多个2列块中重复随机数
我想要一个代码来做一个像意大利面条一样的图,其中x是左边的数字,y是右边的数字。问题是,一条绘图线应该是一个块x和y,黑线是一个分隔,这意味着第二个块x和y是一条不同的绘图线。我还没有在网上找到任何关于这个的参考资料。请帮帮我 我当前使用的代码如下:
import matplotlib.pyplot as plt
import numpy as np
x,y=np.loadtxt('PHDOS2.txt', delimiter=',', unpack=True)
x=x*27211.3
y=y/27211.3
plt.plot(x,y, label='Phonons DoS')
plt.xlabel('Energy (meV)')
plt.ylabel('')
plt.title('Phonons Density of States')
plt.legend()
plt.show()
多谢各位
应该给你一个蓝黑相间的意大利面图。
然而,我不知道你所说的
The thing is, one plot line should be one block x and y and the black line is a separation that means that the second block x and y is a different plot line. I haven't found any reference about that online.
是什么意思相关问题 更多 >
编程相关推荐