
1、导入模块
1from ridge_map import FontManager
2from ridge_map import RidgeMap
3import matplotlib
4import matplotlib.pyplot as plt
5import numpy as np
注:需要安装ridge_map库
2、绘制不同风格山脊地图
绘图1:
1font = FontManager('https://github.com/google/fonts/blob/master/ofl/uncialantiqua/UncialAntiqua-Regular.ttf?raw=True')
2rm = RidgeMap((-156.250305,18.890695,-154.714966,20.275080), font=font.prop)
3values = rm.get_elevation_data(num_lines=150)
4values=rm.preprocess(
5 values=values,
6 lake_flatness=2,
7 water_ntile=10,
8 vertical_ratio=240)
9rm.plot_map(values=values,
10 label="Hawai'i",
11 label_y=0.1,
12 label_x=0.55,
13 label_size=40,
14 linewidth=1)

1font = FontManager('https://github.com/google/fonts/blob/master/ofl/uncialantiqua/UncialAntiqua-Regular.ttf?raw=True')
2rm = RidgeMap((-156.250305,18.890695,-154.714966,20.275080), font=font.prop)
3values = rm.get_elevation_data(num_lines=80)
4rm.plot_map(values=rm.preprocess(values=values, water_ntile=12, vertical_ratio=40),
5 label="Hawai'i",
6 label_x=0.75,
7 linewidth=6,
8 line_color='orange')

绘图3:
1font = FontManager('https://github.com/google/fonts/blob/master/ofl/uncialantiqua/UncialAntiqua-Regular.ttf?raw=True')
2rm = RidgeMap((-156.250305,18.890695,-154.714966,20.275080), font=font.prop)
3values = rm.get_elevation_data(num_lines=150)
4rm.plot_map(values=rm.preprocess(values=values, lake_flatness=3, water_ntile=50, vertical_ratio=30),
5 label="Hawai'i",
6 label_x=0.1,
7 line_color = plt.get_cmap('spring'))

绘图4:
1font = FontManager('https://github.com/google/fonts/blob/master/ofl/uncialantiqua/UncialAntiqua-Regular.ttf?raw=True')
2rm = RidgeMap((-156.250305,18.890695,-154.714966,20.275080), font=font.prop)
3
4values = rm.get_elevation_data(num_lines=100)
5rm.plot_map(values=rm.preprocess(values=values, lake_flatness=2, water_ntile=10, vertical_ratio=240),
6 label="Hawai'i",
7 label_y=0.85,
8 label_x=0.7,
9 label_size=60,
10 linewidth=2,
11 line_color=plt.get_cmap('ocean'),
12 kind='elevation')

绘图5:
1font = FontManager('https://github.com/google/fonts/blob/master/ofl/uncialantiqua/UncialAntiqua-Regular.ttf?raw=True')
2rm = RidgeMap((-156.250305,18.890695,-154.714966,20.275080), font=font.prop)
3
4values = rm.get_elevation_data(num_lines=250, viewpoint='south')
5values = rm.preprocess(values=values,
6 water_ntile=5,
7 vertical_ratio=90)
8
9rm.plot_map(values, label="",
10 kind='elevation',
11 line_color=plt.get_cmap('plasma'),
12 label_size=100)

有问题可以到QQ群里进行讨论,我们在那边等大家。
QQ群号:854684131
文章转载自气海无涯,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




