当前位置:网站首页>Map basemap Library
Map basemap Library
2022-04-23 18:00:00 【Be happy to study today】
Basemap Study
api manual
https://matplotlib.org/basemap/api/basemap_api.html
install basemap library
First installation geos library
pip install geos
Then install basemap library , Install at basemap Of whl file ( Note that version )
https://www.lfd.uci.edu/~gohlke/pythonlibs/#basemap
And then use pip Command after installation , You can use
Make a map
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import numpy as np
# To create a geographic point list
long=[113.8,114,114.5,113.7,114.8,114]
lat=[30,31.2,30,30.5,31,30.5]
gridid=[1,2,3,4,5,6]
count=[10,5,1,22,4,30]
# Drawing base map
map = Basemap(llcrnrlon="113.6",llcrnrlat="29.971819",urcrnrlon="115.2",urcrnrlat="31.362913",\
resolution='h',projection='aea',\
lat_1=25,lat_2=47,lon_0=105,lat_0=30)
# Load vector basemap
filepath = r"E:\code\test5\wuhan.shp"
file = map.readshapefile(filepath[:-4],"Shp",default_encoding='gbk',color="#3641e5")
# Draw points
x, y = map(long, lat)
pointsize = (count-np.min(count)/(np.max(count)-np.min(count)))*10 # Calculate the size of each point
map.scatter(x, y, marker='o',c=range(len(gridid)),s=pointsize)
for a,b,c in zip(x,y,count):
plt.text(a,b,c,ha='left', fontsize=10)
plt.xlabel('longitude')
plt.ylabel('latitude')
plt.title('wuhan people')
plt.show()
#plt.savefig('wuhanpeople.jpg', dpi=120)
Result chart
版权声明
本文为[Be happy to study today]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230545528401.html
边栏推荐
- Classes and objects
- Anchor location - how to set the distance between the anchor and the top of the page. The anchor is located and offset from the top
- Cloud native Virtualization: building edge computing instances based on kubevirt
- Cross domain settings of Chrome browser -- including new and old versions
- An example of linear regression based on tensorflow
- YOLOv4剪枝【附代码】
- In JS, t, = > Analysis of
- 列表的使用-增删改查
- Compilation principle first set follow set select set prediction analysis table to judge whether the symbol string conforms to the grammar definition (with source code!!!)
- JS high frequency interview questions
猜你喜欢
Halo 开源项目学习(二):实体类与数据表
Halo open source project learning (II): entity classes and data tables
开源按键组件Multi_Button的使用,含测试工程
Theory and practice of laser slam in dark blue College - Chapter 2 (odometer calibration)
C1小笔记【任务训练篇二】
2022年茶艺师(初级)考试模拟100题及模拟考试
MySQL 中的字符串函数
Click Cancel to return to the previous page and modify the parameter value of the previous page, let pages = getcurrentpages() let prevpage = pages [pages. Length - 2] / / the data of the previous pag
2022江西储能技术展会,中国电池展,动力电池展,燃料电池展
JS high frequency interview questions
随机推荐
Land cover / use data product download
Chrome浏览器的跨域设置----包含新老版本两种设置
JS get link? The following parameter name or value, according to the URL? Judge the parameters after
Flask项目的部署详解
C language array processing batch data
20222 return to the workplace
Build openstack platform
Click Cancel to return to the previous page and modify the parameter value of the previous page, let pages = getcurrentpages() let prevpage = pages [pages. Length - 2] / / the data of the previous pag
Theory and practice of laser slam in dark blue College - Chapter 2 (odometer calibration)
Leak detection and vacancy filling (VII)
Vite configure proxy proxy to solve cross domain
2022年茶艺师(初级)考试模拟100题及模拟考试
C language loop structure program
C1小笔记【任务训练篇一】
Nat Commun|在生物科学领域应用深度学习的当前进展和开放挑战
C language input and output (printf and scanf functions, putchar and getchar functions)
Flash - Middleware
Operators in C language
587. 安装栅栏 / 剑指 Offer II 014. 字符串中的变位词
Romance in C language