使用rio.plot.show后如何添加色条?
我尝试过很多方法,但是出现了各种错误。
以下是我尝试的其中一种方式:
以下是我尝试的其中一种方式:
fig, ax = plt.subplots(figsize = (16, 16))
retted = rio.plot.show(ds, ax=ax, cmap='Greys_r')
fig.colorbar(retted, ax=ax)
plt.title("Original")
plt.show()
出现了错误:AttributeError: 'AxesSubplot' 对象没有 'get_array' 属性
i = ax.imshow(ds, cmap='Greys_r')
绘制图像,然后用rio绘图覆盖它,最后添加颜色条plt.colorbar(i)
。 - david