from osgeo import gdal
import matplotlib.pyplot as plt
ds = gdal.Open(r"。。。\DEM1.tif")
im_width = ds.RasterXSize
im_height = ds.RasterYSize
im_data = ds.ReadAsArray(0, 0, im_width, im_height)
plt.figure(figsize=(20,18))
plt.imshow(im_data)
plt.show()