擅长:python、mysql、java
<p>我找到了解决方案,即使用alpha混合,如下所示。可以调整alpha参数以改变同时显示两个图像的范围</p>
<pre><code>fig = plt.figure(figsize=(15,15)) # This creates the figure.
im1 = plt.imshow(intensity_image, cmap='gray') # This shows the first image as a grayscale image.
plt.axis('off') # This removes the axes around the image.
plt.clim(200,800) # This clips the values within the first image to the 200-800 range. It affects the values of the colorbar.
plt.colorbar(shrink=0.3, aspect=5.0) # This draws a colorbar that 0.3x the size of the image and is a little bit thicker (aspect=5.0) than the default one.
im2 = plt.imshow(flim_image, cmap='jet', alpha=0.5) # This shows the second image using a 'jet' colorspace.
plt.axis('off') # Removes the image axes.
plt.clim(2.0,3.0) # Clips the image values to the range 2.0-3.0.
plt.colorbar(shrink=0.3, aspect=5.0) # Draws the colorbar for the second image.
plt.show() # Shows the figure.
</code></pre>
<p><a href="https://i.stack.imgur.com/yFnZZ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yFnZZ.jpg" alt="enter image description here"/></a></p>