Skip to content
Snippets Groups Projects
Commit 7465e005 authored by Timo Stomberg's avatar Timo Stomberg
Browse files

cartopy instead of basemaps

parent 23bb8179
Branches
Tags
No related merge requests found
import numpy as np import numpy as np
import pandas as pd import pandas as pd
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap import cartopy
import random import random
from settings import * from settings import *
...@@ -35,18 +35,19 @@ class MapPlot: ...@@ -35,18 +35,19 @@ class MapPlot:
self.markers = [] self.markers = []
def plot(self, annotate=False): def plot(self, annotate=False):
tmap = Basemap(projection='cyl', resolution='l') ax = plt.axes(projection=cartopy.crs.PlateCarree())
tmap.drawcoastlines() ax.add_feature(cartopy.feature.COASTLINE)
tmap.fillcontinents() ax.add_feature(cartopy.feature.BORDERS, linestyle=':')
tmap.drawcountries() ax.add_feature(cartopy.feature.LAND)
ax.add_feature(cartopy.feature.OCEAN)
for i in range(len(self.data_plot)): for i in range(len(self.data_plot)):
lons = self.data_plot[i]['lon'].to_list() lons = self.data_plot[i]['lon'].to_list()
lats = self.data_plot[i]['lat'].to_list() lats = self.data_plot[i]['lat'].to_list()
x, y = tmap(lons, lats) x, y = lons, lats
tmap.scatter(x, y, ax.scatter(x, y,
s=50, s=50,
color=self.colors[i], color=self.colors[i],
marker=self.markers[i], marker=self.markers[i],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment