问题描述
我有一个来自观测的震级数据。我想找到量级的检测完整性。我想在 python 中绘制这样的图形
如何绘制我的 data 的检测完整性和量级
import numpy as np
from astropy.table import Table
data = Table.read('magnitude_data.fits')
plt.hist(data['NB921'],bins=30)
请告诉我如何绘制这样的图。
解决方法
我不确定你的问题是什么,但试试这个:
import matplotlib.pyplot as plt
Data = [1,2,3,4,5,6,7,8,9,10]
Other_Data = [9.8,12,7.2,6.9,6.5,6.2,5.5,6.3]
plt.plot(Data,Other_Data,color='red',marker='o')
plt.title('Data Vs Other_Data',fontsize=14)
plt.xlabel('Data',fontsize=14)
plt.ylabel('Other_Data',fontsize=14)
plt.grid(True)
plt.show()
该代码创建了一个折线图并绘制了data 和other_data 中的数据。
此外,尝试从该文件中提取数据并将其放入这些字符串中。