当前位置:网站首页>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
边栏推荐
- Gaode map search, drag and drop query address
- Transfer learning of five categories of pictures based on VGg
- 2022年茶艺师(初级)考试模拟100题及模拟考试
- Comparison between xtask and kotlin coroutine
- C language input and output (printf and scanf functions, putchar and getchar functions)
- Selenium + phantom JS crack sliding verification 2
- Utilisation de la liste - Ajouter, supprimer et modifier la requête
- Gets the time range of the current week
- In JS, t, = > Analysis of
- 2022 Jiangxi Photovoltaic Exhibition, China Distributed Photovoltaic Exhibition, Nanchang Solar Energy Utilization Exhibition
猜你喜欢
The JS timestamp of wechat applet is converted to / 1000 seconds. After six hours and one day, this Friday option calculates the time
2022江西光伏展,中國分布式光伏展會,南昌太陽能利用展
Remember using Ali Font Icon Library for the first time
[UDS unified diagnostic service] IV. typical diagnostic service (6) - input / output control unit (0x2F)
Qtablewidget usage explanation
JS forms the items with the same name in the array object into the same array according to the name
Go语言JSON包使用
JS get link? The following parameter name or value, according to the URL? Judge the parameters after
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!!!)
Go对文件操作
随机推荐
消费者灰度实现思路
Implementation of k8s redis one master multi slave dynamic capacity expansion
MySQL_ 01_ Simple data retrieval
Add animation to the picture under V-for timing
Array rotation
Vite configure proxy proxy to solve cross domain
2022年广东省安全员A证第三批(主要负责人)特种作业证考试题库及在线模拟考试
cartographer_ There is no problem compiling node, but running the bug that hangs directly
JS high frequency interview questions
QTableWidget使用讲解
Random number generation of C #
2022 judgment questions and answers for operation of refrigeration and air conditioning equipment
How to read literature
ROS package NMEA_ navsat_ Driver reads GPS and Beidou Positioning Information Notes
Chrome浏览器的跨域设置----包含新老版本两种设置
C language implements memcpy, memset, strcpy, strncpy, StrCmp, strncmp and strlen
Solving the problem of displaying too many unique values in ArcGIS partition statistics failed
Svn simple operation command
Using files to save data (C language)
I/O多路复用及其相关详解