1 Star 0 Fork 13

靖老道/python-gdal-test

forked from fungis/python-gdal-test 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
04_读取文本栅格展示.py 587 Bytes
一键复制 编辑 原始数据 按行查看 历史
fungis 提交于 2023-03-18 15:06 . 读取文本栅格展示
# -*- coding: utf-8 -*-
"""
@File : 04_读取文本栅格展示.py
@Author : fungis@163.com
@notice :
"""
import numpy
# import pandas as pd
import matplotlib.pyplot as plt
data = numpy.loadtxt(r'./data-use/table/test.txt', encoding='gbk') # 读取文本数据
# data = pd.read_excel(r'./data-use/test.xls') # 读取表格数据
# 调用figure创建一个绘图对象
fig = plt.figure()
ax = fig.add_subplot()
ticks = numpy.arange(0, 10, 1) # 生成0-10,步长为1
# 生成刻度
ax.set_yticks(ticks)
plt.imshow(data, cmap='tab10')
plt.colorbar() # 绘制图例
plt.show()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/jzhang0767/python-gdal-test.git
git@gitee.com:jzhang0767/python-gdal-test.git
jzhang0767
python-gdal-test
python-gdal-test
master

搜索帮助