42 lines
897 B
Python
42 lines
897 B
Python
|
from shapely.geometry import Point, MultiPoint
|
||
|
from shapely.ops import cascaded_union
|
||
|
import matplotlib.pyplot as plt
|
||
|
import pandas as pd
|
||
|
import cartopy.crs as ccrs
|
||
|
|
||
|
df = pd.read_pickle('data_final.p')
|
||
|
|
||
|
biomes = {}
|
||
|
biome_numbers = df['biome_num'].unique()
|
||
|
for n in biome_numbers:
|
||
|
biomes[n] = []
|
||
|
|
||
|
for (longitude, latitude), row in df.iterrows():
|
||
|
biomes[row.biome_num].append(Point(longitude, latitude))
|
||
|
|
||
|
ax = plt.axes(projection=ccrs.PlateCarree())
|
||
|
ax.stock_img()
|
||
|
|
||
|
colors={
|
||
|
0: '#016936',
|
||
|
1: '#B2D127',
|
||
|
2: '#77CC00',
|
||
|
3: '#99C500',
|
||
|
4: '#B6CC00',
|
||
|
5: '#00C5B5',
|
||
|
6: '#EFFF00',
|
||
|
7: '#FFEE00',
|
||
|
8: '#009BFF',
|
||
|
9: '#A0ADBA',
|
||
|
10: '#5C62FF',
|
||
|
11: '#00850F',
|
||
|
12: '#FF9E1F',
|
||
|
13: '#FF1F97'
|
||
|
}
|
||
|
|
||
|
for n in biome_numbers:
|
||
|
biomes[n] = MultiPoint(biomes[n]).buffer(1)
|
||
|
ax.add_geometries(biomes[n], ccrs.PlateCarree(), facecolor=colors[n])
|
||
|
|
||
|
plt.show()
|