Matplotlib imshow偏移以匹配轴?

Matplotlib imshow偏移以匹配轴?,第1张

Matplotlib imshow偏移匹配轴?

您需要使用

extent
关键字参数来imshow。

作为一个简单的例子

import numpy as npimport matplotlib.pyplot as plt# Random points between 50000 and 51000x, y = 1000 * np.random.random((2, 10)) + 50000# A 10x10 "image"...image = np.arange(100).reshape((10,10))# In a lot of cases, image data will be "flipped" vertically, so you may need # use the `origin` kwarg, as well (or just swap the ymin and ymax ordering).plt.imshow(image, extent=[x.min(), x.max(), y.min(), y.max()])plt.plot(x, y, 'ro')plt.show()


欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/zaji/5654816.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存