fig = plt.figure(figsize=frame_param.long_fig[0], dpi=frame_param.long_fig[1]) geo_axes, proj_1 = axes_helper.get_geo_axes(fig, frame_param.long_fig_geosize) show_fig_logo(fig) colorbar_axes = fig.add_axes(frame_param.colorbar_axes) ct = ColorTable() rc12 = ct.ColorRecords['Rain12HCR'] x, y, v = get_grid_data(rain_frame, 'sum') # 填色 v = gaussian_filter(v, sigma=3) cs = geo_axes.contourf(x, y, v, levels=rc12.Level, colors=rc12.StrColor) # 填图 c_level_station = rain_frame_ah[ (rain_frame_ah['sw_flag'] == 0) & (rain_frame_ah['Station_Id_C'].str.startswith('5'))] c_level_station = c_level_station.reset_index()可以帮我改成在地里坐标轴上绘制散点图吗
时间: 2024-01-17 22:03:40 浏览: 84
matplotilb中fig,ax = plt.subplots()的使用
当然可以,你可以使用`geo_axes.scatter`方法在地图上绘制散点图。下面是修改后的代码:
```
fig = plt.figure(figsize=frame_param.long_fig[0], dpi=frame_param.long_fig[1])
geo_axes, proj_1 = axes_helper.get_geo_axes(fig, frame_param.long_fig_geosize)
show_fig_logo(fig)
colorbar_axes = fig.add_axes(frame_param.colorbar_axes)
ct = ColorTable()
rc12 = ct.ColorRecords['Rain12HCR']
x, y, v = get_grid_data(rain_frame, 'sum')
# 填色
v = gaussian_filter(v, sigma=3)
cs = geo_axes.contourf(x, y, v, levels=rc12.Level, colors=rc12.StrColor)
# 在地图上绘制散点图
c_level_station = rain_frame_ah[(rain_frame_ah['sw_flag'] == 0) & (rain_frame_ah['Station_Id_C'].str.startswith('5'))]
c_level_station = c_level_station.reset_index()
# 将经纬度坐标转换为地图坐标
lon = c_level_station['Lon'].values
lat = c_level_station['Lat'].values
x, y = proj_1(lon, lat)
geo_axes.scatter(x, y, s=10, c='red')
```
这里我假设你的散点数据包含经纬度信息,我们需要将其转换为地图坐标。另外,`scatter`方法中的参数`s`表示散点的大小,`c`表示散点的颜色。你可以根据需要自行修改。
阅读全文