我有一个 numpy 2d 数组,我想将其显示为常规线条图后面的位图图像。
import matplotlib as mpl
from numpy import arange
figure = mpl.figure.Figure(dpi=70)
image = my_numpy_array #This is a regular float32 2D array created somewhere else
#I'm using a single sinus phase but the plot could be any (x, y) based function
x = arange(0, 360, 0.01)
y = 100*sin(pi*self.x/180)
subplot = figure.add_subplot(111)
self.subplot.imshow(image) #Doesn't work; how do I display the bitmap in the same subplot
self.subplot.plot(x,y)
figure.show() #I see the graphic and the sinus just fine but not my bitmap
最终我想要这样的东西:
其中 0 对应于白色,0.01 和 1 之间的任何值都将根据色标显示。现在我看到了窦波,但没有看到点。