【发布时间】:2022-01-19 01:31:01
【问题描述】:
我想以特定模式绘制图像,如下图所示
我想了解使用 python 绘制图像的最佳方法是什么。我使用以下方法以网格模式绘制图像。 输出看起来像这样
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
import matplotlib as mpl
from matplotlib.dates import date2num
import matplotlib.dates as mdates
from mpl_toolkits.axes_grid1 import ImageGrid
img0 = f['B00'][i_ant, :, :]
img1 = f['B01'][i_ant, :, :]
img2 = f['B02'][i_ant, :, :]
img3 = f['B03'][i_ant, :, :]
img_arr = [img0,img1,img2,img3]
fig = plt.figure(figsize=(5., 5.))
grid = ImageGrid(fig, 111,
nrows_ncols=(2, 2), # creates 2x2 grid of axes
axes_pad=0, # pad between axes
)
for ax, im in zip(grid, img_arr):
ax.imshow(im)
plt.show()
【问题讨论】:
-
你的代码产生的情节是什么样子的?
-
刚刚添加了它看起来的情节
-
图像是否需要按照它们在示例图像中出现的顺序添加(从中心开始逆时针对角线)?
-
是的,从中心开始的顺序相同
-
理想情况下,它适用于 36 张图片。
标签: python matplotlib ggplot2 plot