# ドーバー海峡周辺のデータを抽出（2ノット以上で移動している船舶に限定）
df_dover = df[
    (df["Message.PositionReport.Longitude"].between(1.0, 2.5)) &
    (df["Message.PositionReport.Latitude"].between(50.5, 51.5)) &
    (df["Message.PositionReport.Sog"] >= 2.0)
].copy()
 
fig = plt.figure(figsize=(12, 8))
ax = plt.axes(projection=ccrs.PlateCarree())
ax.set_extent([1.0, 2.5, 50.5, 51.5]) # 指定海域にズーム
 
# 第3章と共通の配色設定
ax.set_facecolor("#1a1c1e")
ax.add_feature(cfeature.LAND, facecolor="#323539")
 
# COG（進行方向）をhsvカラーマップで表現
# 0度と360度が繋がる循環型のマップが適している
sc = ax.scatter(
    df_dover["Message.PositionReport.Longitude"],
    df_dover["Message.PositionReport.Latitude"],
    c=df_dover["Message.PositionReport.Cog"],
    s=1, cmap="hsv", transform=ccrs.PlateCarree()
)
 
plt.colorbar(sc, label="COG (degrees)")
plt.show()
 
fig.savefig("figure3.png", dpi=300, bbox_inches="tight")
plt.close(fig)
