import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature
 
# 蓄積された時間枠から1つを選択（例：インデックス1）
times = df_snapshot["time_utc_rounded"].unique()
target_time = times[1]
snapshot = df_snapshot[df_snapshot["time_utc_rounded"] == target_time]
 
fig = plt.figure(figsize=(15, 8))
ax = plt.axes(projection=ccrs.PlateCarree())
ax.set_global()
 
# 描画設定：暗色の背景（海と陸地）
ax.set_facecolor("#1a1c1e")
ax.add_feature(cfeature.LAND, facecolor="#323539", zorder=1)
 
# 位置情報をプロット。重なりを可視化するためサイズを最小（s=1）に設定
plt.scatter(
    snapshot["Message.PositionReport.Longitude"],
    snapshot["Message.PositionReport.Latitude"],
    s=1, alpha=0.5, c="#ff0000", edgecolors="none",
    transform=ccrs.PlateCarree(), zorder=2
)
 
plt.title(f"{target_time}")
plt.show()
 
fig.savefig("figure1.png", dpi=300, bbox_inches="tight")
plt.close(fig)
