diff --git a/source/dataset_mapplot.py b/source/dataset_mapplot.py index 06ba28eee07767f35286d606d3a20887c5d23747..617e0595d3a41914a05ddc3f7c5f7f469bca0708 100644 --- a/source/dataset_mapplot.py +++ b/source/dataset_mapplot.py @@ -1,7 +1,7 @@ import numpy as np import pandas as pd import matplotlib.pyplot as plt -from mpl_toolkits.basemap import Basemap +import cartopy import random from settings import * @@ -35,25 +35,26 @@ class MapPlot: self.markers = [] def plot(self, annotate=False): - tmap = Basemap(projection='cyl', resolution='l') - tmap.drawcoastlines() - tmap.fillcontinents() - tmap.drawcountries() + ax = plt.axes(projection=cartopy.crs.PlateCarree()) + ax.add_feature(cartopy.feature.COASTLINE) + ax.add_feature(cartopy.feature.BORDERS, linestyle=':') + ax.add_feature(cartopy.feature.LAND) + ax.add_feature(cartopy.feature.OCEAN) for i in range(len(self.data_plot)): lons = self.data_plot[i]['lon'].to_list() lats = self.data_plot[i]['lat'].to_list() - x, y = tmap(lons, lats) + x, y = lons, lats - tmap.scatter(x, y, - s=50, - color=self.colors[i], - marker=self.markers[i], - alpha=0.5, - edgecolor='black', - label=self.labels[i], - zorder=2) + ax.scatter(x, y, + s=50, + color=self.colors[i], + marker=self.markers[i], + alpha=0.5, + edgecolor='black', + label=self.labels[i], + zorder=2) if annotate: if i == 0: