Browse Source

Add title, legend, and data note.

master
Nathan Bergey 5 years ago
parent
commit
fa5867aabf
  1. BIN
      tornados_us.png
  2. 27
      tornados_us.py

BIN
tornados_us.png

Before

Width: 2560  |  Height: 1475  |  Size: 1.4 MiB

After

Width: 2280  |  Height: 1349  |  Size: 1.3 MiB

27
tornados_us.py

@ -14,7 +14,7 @@ import shapely.geometry as sgeom
proj = ccrs.AlbersEqualArea(
central_longitude=-93,
central_longitude=-95,
central_latitude=35,
)
water_blue = "#7ebfd4"
@ -90,30 +90,31 @@ def read_data():
def draw_map(f_unknown, f_zero, f_one, f_two, f_three, f_four, f_five):
fig = plt.figure(frameon=False, figsize=(8, 4.61))
ax = fig.add_axes([0, 0, 1, 1], projection=proj)
fig = plt.figure(frameon=False, figsize=(12, 7.1))
ax = fig.add_axes([0, 0, 1, 0.95], projection=proj)
ax.background_patch.set_facecolor(water_blue)
ax.set_extent([-122, -65, 20, 50], ccrs.Geodetic())
ax.set_extent([-122, -65, 21, 50], ccrs.Geodetic())
ax.add_feature(land, facecolor="#f0f0f0")
# ax.add_feature(rivers, edgecolor=water_blue)
ax.add_feature(lakes, facecolor=water_blue)
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='--')
ax.coastlines(resolution='50m', color="#55aacc", linewidth=0.2)
geodetic = ccrs.Geodetic()
ax.plot(f_unknown.lons, f_unknown.lats, 'k', lw=0.2, alpha=0.7, label="Unknown", transform=geodetic)
ax.plot(f_zero.lons, f_zero.lats, '#ffbb00', lw=0.1, alpha=1, label="F0", transform=geodetic)
ax.plot(f_one.lons, f_one.lats, '#ff7700', lw=0.1, alpha=1, label="F1", transform=geodetic)
ax.plot(f_two.lons, f_two.lats, '#ff4400', lw=0.2, alpha=0.8, label="F2", transform=geodetic)
ax.plot(f_three.lons, f_three.lats, '#ff1100', lw=0.3, alpha=0.8, label="F3", transform=geodetic)
ax.plot(f_four.lons, f_four.lats, 'r', lw=0.4, alpha=0.8, label="F4", transform=geodetic)
ax.plot(f_five.lons, f_five.lats, 'r', lw=0.6, alpha=0.7, label="F5", transform=geodetic)
ax.plot(f_zero.lons, f_zero.lats, '#ffbb00', lw=0.2, alpha=1, label="F0", transform=geodetic)
ax.plot(f_one.lons, f_one.lats, '#ff7700', lw=0.3, alpha=1, label="F1", transform=geodetic)
ax.plot(f_two.lons, f_two.lats, '#ff4400', lw=0.4, alpha=0.8, label="F2", transform=geodetic)
ax.plot(f_three.lons, f_three.lats, '#ff1100', lw=0.5, alpha=0.8, label="F3", transform=geodetic)
ax.plot(f_four.lons, f_four.lats, 'r', lw=0.6, alpha=0.8, label="F4", transform=geodetic)
ax.plot(f_five.lons, f_five.lats, 'r', lw=0.8, alpha=0.7, label="F5", transform=geodetic)
ax.axis('off')
plt.title(" US Tornados 1950-2017", loc='left')
ax.text(0, 0.01, " data from https://www.spc.noaa.gov/wcm/", transform=ax.transAxes, fontsize=6)
plt.legend(loc=4, title="Intensity", fontsize='small')
plt.savefig("tornados_us.png", dpi=320)
plt.savefig("tornados_us.png", dpi=190)
@dataclass

Loading…
Cancel
Save