def plot_image(data, vmin=None, vmax=None, colorbar=True, cmap="gray"):
"""
Plot image data, such as RTM images or FWI gradients.
:param data: Image data to plot
:param cmap: Choice of colormap, default is gray scale for images as a
seismic convention
"""
plot = plt.imshow(np.transpose(data),
vmin=vmin or 0.9 * np.min(data),
vmax=vmax or 1.1 * np.max(data),
cmap=cmap)
# Create aligned colorbar on the right
if colorbar:
ax = plt.gca()
divider = make_axes_locatable(ax)
cax = divider.append_axes("right", size="5%", pad=0.05)
plt.colorbar(plot, cax=cax)
plt.show()
评论列表
文章目录