A python package to draw china maps more easily
Project description
cnmaps 是一个可以让中国地图画起来更丝滑的地图类python扩展包
安装
安装 cnmaps 需要满足 Python 的解释器在 3.9 版本及以上。
使用pip安装
cnmaps 最简单也最快的安装方法是使用 pip 来安装 cnmaps: $ pip install -U cnmaps
使用conda安装
你也可以使用 conda 安装: $ conda install -c conda-forge cnmaps
快速开始
绘制国界
用最简单直接的方式,来绘制你的第一张中国地图。
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
from cnmaps import get_adm_maps, draw_maps
fig = plt.figure(figsize=(10,10))
ax = fig.add_subplot(111, projection=ccrs.PlateCarree())
draw_maps(get_adm_maps(level='国'))
plt.show()
绘制省界
cnmaps还可以绘制各省(特区/直辖市)的地图
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
from cnmaps import get_adm_maps, draw_maps
fig = plt.figure(figsize=(10,10))
ax = fig.add_subplot(111, projection=ccrs.PlateCarree())
draw_maps(get_adm_maps(level='省'), linewidth=0.8, color='r')
plt.show()
绘制市界
cnmaps可以绘制市级的行政区地图。
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
from cnmaps import get_adm_maps, draw_maps
fig = plt.figure(figsize=(15,15))
ax = fig.add_subplot(111, projection=ccrs.PlateCarree())
draw_maps(get_adm_maps(level='市'), linewidth=0.5, color='g')
plt.show()
绘制区县界
cnmaps可以绘制区县级的行政区地图。
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
from cnmaps import get_adm_maps, draw_maps
fig = plt.figure(figsize=(20,20))
ax = fig.add_subplot(111, projection=ccrs.PlateCarree())
draw_maps(get_adm_maps(level='区县'), linewidth=0.8, color='r')
plt.show()
使用指南
针对本项目更多的使用方法,我们还有一份更详细的文档:cnmaps使用指南
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cnmaps-1.1.9.tar.gz.
File metadata
- Download URL: cnmaps-1.1.9.tar.gz
- Upload date:
- Size: 50.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7ff9479373158a41f4466253b324de544788b3807383f885a4c193c142da856
|
|
| MD5 |
4abe0ca46fc4930d0ebb85a07ed07586
|
|
| BLAKE2b-256 |
79d73b2163de903faaf1387f23e125a3c526586cddcfee8cebbc92c52651f984
|
File details
Details for the file cnmaps-1.1.9-py3-none-any.whl.
File metadata
- Download URL: cnmaps-1.1.9-py3-none-any.whl
- Upload date:
- Size: 51.9 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dbed91afcc9b8838b50179015eadf810e6495258eb04eff2ebad35d87bdac44
|
|
| MD5 |
c0ad76b34b034a1be666d6e20cd48f66
|
|
| BLAKE2b-256 |
1a33564f73a0eaeabd8cf99c17e961e0af93afa3dd7f15d1fafcf6117abe2b64
|