jupyter qtconsole,matplotlib:将显示的图像缩放到窗口宽度

时间:2018-04-12 16:24:46

标签: matplotlib jupyter python-3.6 image-scaling qtconsole

我想将我在jupyter qtconsole中显示的图像缩放为窗口宽度

所有图像的尺寸均为5x5cm,但实际尺寸有多大。尝试使用1k x 1k图像和7,7k x 7,7k图像。显示相同。 我认为这不是天文问题,而是matplotlib或jupyter qtconsole。 无法在matplotlib或jupyter qtconsole的文档中找到任何内容。

代码是:

`from astropy.io import fits
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm    

img_file = 'rxcj0920.1+8602.fits' # 1kx1k
hdu_list = fits.open(img_file)
img_data = hdu_list[0].data

plt.imshow(img_data, cmap='gist_heat', origin='lower', norm=LogNorm(), vmin=400, vmax= 65e3), plt.colorbar()`

1 个答案:

答案 0 :(得分:0)

确实

import matplotlib
matplotlib.rcParams['figure.figsize'] = (10.,10.)

有什么影响吗?