我正在尝试绘制我创建的几个圆圈的轮廓 - 并且仅是轮廓。到目前为止,这是我的代码:
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature
from matplotlib.patches import PathPatch
from matplotlib.path import Path
import matplotlib.ticker as mticker
import numpy as np
# Koordinaten des gewünschten Ausschnitts
lon_west = 17
lon_east = 35
lat_south = 57
lat_north = 70
proj = ccrs.PlateCarree()
plt.figure(figsize=(16, 10))
ax = plt.axes(projection=ccrs.Orthographic(central_longitude=24.3, central_latitude=61.83, globe=None))
ax.set_extent([lon_west, lon_east, lat_south, lat_north], crs=proj)
# Hinzufügen von Eigenschaften zu der Karte
ax.coastlines(linewidth=.5)
ax.add_feature(cfeature.LAND, color='gray', alpha=.15)
ax.add_feature(cfeature.BORDERS, linestyle='-', linewidth=.6)
# Zeichne Meridiane und Breitenkreise
gl = ax.gridlines(draw_labels=True, linewidth=.5, color='gray', alpha=.5, linestyle='-.')
gl.ylocator = mticker.FixedLocator([57, 60, 63, 66])
gl.top_labels = False
gl.left_labels = False
# Definition der Reichweite und die Koordinaten
radius = 250 # km
lons = (21.64, 22.5, 23.82, 24.5, 25.44, 26.32, 26.9, 27.11, 27.38, 29.45, 29.8)
lats = (60.13, 61.81, 63.1, 60.56, 62.3, 64.77, 67.14, 60.9, 62.86, 63.84, 61.91)
# Hinzufügen der Koordinaten und Reichweite der Radarstationen
for lon, lat in zip(lons, lats):
theta = np.linspace(0, 2 * np.pi, 100)
x = lon + radius * 1000.0 * np.cos(theta)
y = lat + radius * 1000.0 * np.sin(theta)
path_data = np.column_stack([x, y])
codes = [Path.MOVETO] + [Path.LINETO] * (len(x) - 1)
path = Path(path_data, codes)
patch = PathPatch(path, transform=ccrs.PlateCarree(), edgecolor="black", lw=0.5, linestyle="--", facecolor='none')
ax.add_patch(patch)
ax.scatter(lon, lat, color='black', marker='o', s=2, transform=proj)
plt.show
我已经在网上搜索过,但到目前为止找不到解决方案。如果有人可以帮助我,那就太好了:)