当前位置:网站首页>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
边栏推荐
- re正则表达式
- Clion installation tutorial
- Comparison between xtask and kotlin coroutine
- Cross domain settings of Chrome browser -- including new and old versions
- Theory and practice of laser slam in dark blue College - Chapter 2 (odometer calibration)
- String function in MySQL
- _ FindText error
- 2022 Jiangxi energy storage technology exhibition, China Battery exhibition, power battery exhibition and fuel cell Exhibition
- 2022 Jiangxi Photovoltaic Exhibition, China Distributed Photovoltaic Exhibition, Nanchang Solar Energy Utilization Exhibition
- .104History
猜你喜欢
Gets the time range of the current week
Uniapp custom search box adaptation applet alignment capsule
Go语言JSON包使用
MySQL_ 01_ Simple data retrieval
Go file operation
2022 tea artist (primary) examination simulated 100 questions and simulated examination
2022江西光伏展,中國分布式光伏展會,南昌太陽能利用展
编译原理 求first集 follow集 select集预测分析表 判断符号串是否符合文法定义(有源码!!!)
2022年上海市安全员C证操作证考试题库及模拟考试
String function in MySQL
随机推荐
纳米技术+AI赋能蛋白质组学|珞米生命科技完成近千万美元融资
SystemVerilog (VI) - variable
消费者灰度实现思路
Read excel, int digital time to time
编译原理 求first集 follow集 select集预测分析表 判断符号串是否符合文法定义(有源码!!!)
ROS package NMEA_ navsat_ Driver reads GPS and Beidou Positioning Information Notes
Uniapp custom search box adaptation applet alignment capsule
Basic usage of crawler requests
[appium] write scripts by designing Keyword Driven files
MySQL_01_简单数据检索
C#的随机数生成
Submit local warehouse and synchronize code cloud warehouse
Halo 开源项目学习(二):实体类与数据表
C [file operation] read TXT text by line
Implementation of k8s redis one master multi slave dynamic capacity expansion
Special effects case collection: mouse planet small tail
C language array processing batch data
Cross domain settings of Chrome browser -- including new and old versions
MySQL_ 01_ Simple data retrieval
20222 return to the workplace