我想以適合的格式繪制此影像。

但我得到了這個

我試圖用 imshow 改變軸,但它沒有做任何更好的事情。這是我正在使用的代碼。
import matplotlib.pyplot as plt
from astropy.visualization import astropy_mpl_style
plt.style.use(astropy_mpl_style)
from astropy.utils.data import get_pkg_data_filename
from astropy.io import fits
image_file = get_pkg_data_filename('Or.fits')
fits.info(image_file)
image_data = fits.getdata(image_file, ext=0)
print(image_data.shape)
plt.figure()
plt.imshow(image_data, cmap='gray')
plt.colorbar()
uj5u.com熱心網友回復:
從您在問題中發布的第二張圖片來看,它似乎image_data具有超大的值,大多數資料點都非常小。嘗試對數映射資料點以希望解決問題。
將以下內容添加到代碼的開頭:
from matplotlib.colors import LogNorm
并將繪圖線更改為以下內容,以便 matplotlib 在繪制影像時使用這些值的對數。
plt.imshow(image_data, cmap='gray', norm=LogNorm())
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/374593.html
標籤:Python matplotlib 星象 适合
