diff --git a/tornados_us.png b/tornados_us.png index 8481ce1..8c88a42 100644 Binary files a/tornados_us.png and b/tornados_us.png differ diff --git a/tornados_us.py b/tornados_us.py index faf1bb4..46fee82 100644 --- a/tornados_us.py +++ b/tornados_us.py @@ -13,8 +13,8 @@ import shapely.geometry as sgeom proj = ccrs.AlbersEqualArea( - central_longitude=-95, - central_latitude=40, + central_longitude=-93, + central_latitude=35, ) water_blue = "#7ebfd4" @@ -87,11 +87,11 @@ def read_data(): return tornados -def draw_map(data): - fig = plt.figure(frameon=False) - ax = fig.add_subplot(111, projection=proj) +def draw_map(lons, lats): + fig = plt.figure(frameon=False, figsize=(8, 4.61)) + ax = fig.add_axes([0, 0, 1, 1], projection=proj) ax.background_patch.set_facecolor(water_blue) - ax.set_extent([-125, -65, 20, 50], ccrs.Geodetic()) + ax.set_extent([-122, -65, 20, 50], ccrs.Geodetic()) ax.add_feature(land, facecolor="#f0f0f0") ax.add_feature(rivers, edgecolor=water_blue) ax.add_feature(lakes, facecolor=water_blue) @@ -99,17 +99,22 @@ def draw_map(data): ax.add_feature(countries, edgecolor="grey", linewidth=0.2, alpha=0.6, dashes='--') ax.add_feature(states, edgecolor="grey", linewidth=0.2, alpha=0.4, dashes='--') - for i, t in enumerate(data): - print(i) - if t.elon < 0: - ax.plot([t.slon, t.elon], [t.slat, t.elat], 'r', lw=0.3, transform=ccrs.Geodetic()) - else: - ax.plot([t.slon, t.slon], [t.slat, t.slat], 'r', lw=0.3, transform=ccrs.Geodetic()) + ax.plot(lons, lats, 'r', lw=0.2, alpha=0.7, transform=ccrs.Geodetic()) - fig.tight_layout() + ax.axis('off') plt.savefig("tornados_us.png", dpi=320) if __name__ == '__main__': ts = read_data() - draw_map(ts) + lons = [] + lats = [] + for t in ts: + if t.elon < 0: + lons.append(t.slon) + lons.append(t.elon) + lons.append(None) + lats.append(t.slat) + lats.append(t.elat) + lats.append(None) + draw_map(lons, lats)